zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
2.15k stars 88 forks source link

Package @zenstackhq/tanstack-query is missing when building a Nuxt 3 app for production. #1867

Open emadzz opened 5 hours ago

emadzz commented 5 hours ago

Description and expected behavior When running npm run build to build a Nuxt 3 app, the command fails due to the following error:

Nuxt Build Error: [vite]: Rollup failed to resolve import "@zenstackhq/tanstack-query/runtime-v5" from "<...>/my-project/lib/hooks/index.ts".

Screenshots N/A

Environment (please complete the following information):

Additional context In the documentation, the code snippet installs @zenstackhq/tanstack-query as a devDependencies which gets removed when running npm run build / nuxt build.

Screenshot 2024-11-18 at 00 26 38

Moving the dependency to dependencies fixes this issue.

I'm not familiar with building tools like Vite but it seems this is an intended behavior and maybe the documentation should be updated?

ymc9 commented 4 hours ago

Hi @emadzz , the doc is outdated. Please install "@zenstackhq/tanstack-query" without the "-D" flag. It needs to be a regular dependency instead of dev. I'll fix the doc. Thanks for reporting this!