nuxt-auth
nuxt-auth copied to clipboard
Warning on Build: Dynamic and Static Import Conflict
Environment
- Operating System: Linux
- Node Version: v20.11.1
- Nuxt Version: 3.10.2
- CLI Version: 3.10.1
- Nitro Version: 2.8.1
- Package Manager: [email protected]
- Builder: -
- User Config: modules, runtimeConfig, routeRules, app, vite, build, radix, gtag, colorMode, auth, typescript, devtools
- Runtime Modules: @sidebase/[email protected], @vueuse/[email protected], @nuxtjs/[email protected], @pinia/[email protected], @pinia-plugin-persistedstate/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], [email protected], [email protected], radix-vue/nuxt, [email protected], [email protected]
- Build Modules: -
Reproduction
No response
Describe the bug
I've encountered a warning during the build process. I get this error both on Vercel and Ubuntu node server Auth works as intended on Vercel but I have some problems on node server I dont know if they are related to this.
WARN [plugin:vite:reporter]
(!) /home/ubuntu/projects/******.com/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sidebase/nuxt-auth/dist/runtime/middleware/auth.mjs is dynamically imported by virtual:nuxt:/home/ubuntu/projects/******.com/.nuxt/middleware.mjs but also statically imported by /home/ubuntu/projects/******.com/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sidebase/nuxt-auth/dist/runtime/plugin.mjs, dynamic import will not move module into another chunk.
Additional context
No response
Logs
No response
Thanks for your report. This is likely caused by middleware being added differently in these two places:
1: https://github.com/sidebase/nuxt-auth/blob/0bc80f7ecd52e5fac856104249ea98f45fddf974/src/runtime/plugin.ts#L2 https://github.com/sidebase/nuxt-auth/blob/0bc80f7ecd52e5fac856104249ea98f45fddf974/src/runtime/plugin.ts#L93-L95
2: https://github.com/sidebase/nuxt-auth/blob/0bc80f7ecd52e5fac856104249ea98f45fddf974/src/module.ts#L215-L218
The task would really be to unify the approach (use same addRouteMiddleware
in both).
We've encountered the same issue. Has there been any solutions so far?
I've the same issue, any solution?
(!) /node_modules/@sidebase/nuxt-auth/dist/runtime/middleware/auth.mjs is dynamically imported by virtual:nuxt:/.nuxt/middleware.mjs but also statically imported by /node_modules/@sidebase/nuxt-auth/dist/runtime/plugin.mjs, dynamic import will not move module into another chunk.
Any update on this? Still facing the same error in version 0.7.1
This problem also exists in 0.7.2😅😅🥲
Please stop bumping, we know the issue exists (and we acknowledged it). If someone has a fix or better understanding how to unify middleware imports mentioned here https://github.com/sidebase/nuxt-auth/issues/669#issuecomment-1959424920, it would be much more useful to get this issue fixed