Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning on Build: Dynamic and Static Import Conflict #669

Open
tberk opened this issue Feb 19, 2024 · 6 comments
Open

Warning on Build: Dynamic and Static Import Conflict #669

tberk opened this issue Feb 19, 2024 · 6 comments
Labels
bug A bug that needs to be resolved help-needed Action needed: The help of the community would be appreciated p3 Minor issue

Comments

@tberk
Copy link

tberk commented Feb 19, 2024

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 tberk added the bug label Feb 19, 2024
@phoenix-ru
Copy link
Collaborator

Thanks for your report. This is likely caused by middleware being added differently in these two places:

1:

import authMiddleware from './middleware/auth'

addRouteMiddleware('auth', authMiddleware, {
global: true
})

2:

nuxt-auth/src/module.ts

Lines 215 to 218 in 0bc80f7

addRouteMiddleware({
name: 'auth',
path: resolve('./runtime/middleware/auth')
})

The task would really be to unify the approach (use same addRouteMiddleware in both).

@zoey-kaiser zoey-kaiser added p3 Minor issue bug A bug that needs to be resolved and removed bug labels Feb 23, 2024
@MelvinIdema

This comment was marked as off-topic.

@joaltoroc

This comment was marked as off-topic.

@blorbis-fpg

This comment was marked as off-topic.

@youkei-zzz

This comment was marked as off-topic.

@phoenix-ru
Copy link
Collaborator

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 #669 (comment), it would be much more useful to get this issue fixed

@phoenix-ru phoenix-ru added the help-needed Action needed: The help of the community would be appreciated label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved help-needed Action needed: The help of the community would be appreciated p3 Minor issue
Projects
None yet
Development

No branches or pull requests

7 participants