nuxt-auth icon indicating copy to clipboard operation
nuxt-auth copied to clipboard

Warning on Build: Dynamic and Static Import Conflict

Open tberk opened this issue 1 year ago • 6 comments

Environment

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

tberk avatar Feb 19 '24 08:02 tberk

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).

phoenix-ru avatar Feb 22 '24 13:02 phoenix-ru

We've encountered the same issue. Has there been any solutions so far?

MelvinIdema avatar Mar 07 '24 10:03 MelvinIdema

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.

joaltoroc avatar Mar 25 '24 14:03 joaltoroc

Any update on this? Still facing the same error in version 0.7.1

blorbis-fpg avatar Apr 15 '24 01:04 blorbis-fpg

This problem also exists in 0.7.2😅😅🥲

youkei-zzz avatar Apr 24 '24 05:04 youkei-zzz

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

phoenix-ru avatar May 16 '24 10:05 phoenix-ru