-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zenstack generate fails with pnpm #560
Comments
Hello, Same issue with a simpler project, and pnpm, but without Nuxt/any dependency, neither tsconfig.json, when trying
|
Thanks for reporting this! I'll look into it and share my finding soon. |
Hi @lewebsimple @NeoN0x , it turns out that I'll make a fix in the upcoming release. |
Fixed in release 1.0.0-beta.7. |
Thanks a lot for your prompt answer & fix. I'm experimenting with pnpm/pnpm workspace, and just installed zenstack "zenstack": "1.0.0-beta.7" and prisma with pnpm, and having the sample default model (schema.zmodel with User and Post). However, I'm still having the issue :
But it seems that this is specifically linked to workspace. By not using workspace, it does not have the error. My pnpm-workspace.yaml
I'm very new to monorepo things, and after googling it (https://typescript.tv/errors/includes/ts2xxx/ts2742) it is something that might be related (quoted: In a monorepository the error TS2742 can show up when you are using a package that has not set a “main” property in its “package.json” file. Sometimes it also happens that there is a “types” property which does not point to the correct typings. Make sure both paths are present and relative:) If this is not fixable, what do you advise, should Switch back to npm/yarn workspaces ? |
Hey @NeoN0x , thanks for confirming this! I just tried pnpm workspace and do see the same problems. I thought explicit type annotation could be avoided, but it seems Let me add those annotations and I think the problems should just go away. Will publish a new version soon. |
The fix in 1.0.0-beta.7 works flawlessly in the same Nuxt projet that previously didn't work. Thanks 🎉 update well ... it installs correctly but the generated tRPC routers can't import named exports from
instead of |
Hi @NeoN0x , I've added type annotation to the generated Zod schemas and pushed a new "beta.8" release. Could you check if it's working in your project now? Thanks! |
Hi @ymc9 , I set up the beta.7 to have the exact issue, then only changed to beta.8 and worked perfectly ! Thanks a lot for your dedication ;) -- For what it worth, further my previous exploration, I managed to use pnpm workspace + beta.7 with the following setting in the
So I think somehow the issue with using the node_module and conflicted somewhere in the symlink and specifying the output make it clear. I understand that edge case are very complexe to manage for library like zenstack. I'm also impressed by the by the fix 574 and how it makes this more robust. |
Awesome! So happy it's working now. Yes, you're right. If the zod plugin's output location is hoisted outside "node_modules" the problem doesn't happen. Having the default configuration to work flawlessly will probably reduce some friction. Thanks for catching this issue. Feel free to join discord if you haven't 😄: https://go.zenstack.dev/chat |
Description and expected behavior
Generating with
zenstack generate
fails in Nuxt 3 project when using pnpm (works fine with npm).Environment (please complete the following information):
Additional context
I'm trying to setup ZenStack in a Nuxt project using tRPC but I'm stumbling on the following error when generating the initial client with pnpm:
This is likely due to the way Nuxt handles
tsconfig.json
The text was updated successfully, but these errors were encountered: