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.07k stars 88 forks source link

Following 'Quick Start' guide will report the 'swr' lib missing #332

Closed seanxlliu closed 1 year ago

seanxlliu commented 1 year ago

Description and expected behavior Reported an error:

Import trace for requested module:
./src/lib/hooks/session.ts
./src/lib/hooks/index.ts
./src/pages/index.tsx
wait  - compiling /_error (client and server)...
error - ./node_modules/@zenstackhq/react/runtime/swr.js:36:0
Module not found: Can't resolve 'swr'
Did you mean './swr'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, /Users/xl/Work/emally/eSense/esense).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.

https://nextjs.org/docs/messages/module-not-found

Should start without errors

Screenshots N/A

Environment (please complete the following information):

Additional context yarn add swr will resolve the issue

ymc9 commented 1 year ago

Thanks for reporting this! In the latest version @zenstackhq/react doesn't include dependency for swr anymore. I'll fix the doc to instruct users install it.

ymc9 commented 1 year ago

fixed with https://github.com/zenstackhq/zenstack-docs/pull/94