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
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1077129966354964480/Screenshot_2566-02-20_at_14.22.17.png)
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1077129966615019580/Screenshot_2566-02-20_at_14.28.23.png)
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1077129966866681897/Screenshot_2566-02-20_at_14.27.57.png)
3 Replies
other-emerald•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.jsrobust-apricot•2y ago
After adding
transpilePackages: ["casbin"]
to next.config.js
the warning message still shows up![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1077243838143402124/Screenshot_2566-02-20_at_22.02.09.png)
other-emerald•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