Default access-control-casbin with next.js give warning of critical dependency
After integrating casbin with refine next.js project, I follow through boiler template but with next.js
warn - ./node_modules/casbin/lib/esm/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
3 Replies
firm-tan•2y ago
Hey @phumcentral,
Can you try adding the casbin package to the
transpilePackages
array of the next.config.js
file?
If your project doesn't exist next.config.js
, you can add like here:
https://github.com/refinedev/refine/blob/next/examples/with-nextjs/next.config.jscorrect-apricot•2y ago
After adding
transpilePackages: ["casbin"]
to next.config.js
the warning message still shows upfirm-tan•2y ago
Our casbin example may outdated. If you create a new example for us following the below link, we will be very grateful. 🙏
https://casbin.org/docs/frontend
Frontend Usage | Casbin
Casbin.js is a Casbin addon that facilites your access-control management in the frontend application