Skip to content

eager dependency pre-bundling is no longer working #28195

@madeofsun

Description

@madeofsun

Environment

Working directory: /home/projects/github-um8mfw-zyx1rr                             16:29:50
Nuxt project info:                                                                 16:29:50

------------------------------
- Operating System: Linux
- Node Version:     v18.20.3
- Nuxt Version:     3.12.3
- CLI Version:      3.12.0
- Nitro Version:    2.9.7
- Package Manager:  npm@10.2.3
- Builder:          -
- User Config:      ssr, vite, compatibilityDate, devtools
- Runtime Modules:  -
- Build Modules:    -
------------------------------

Reproduction

Link to project with faulty behaviour (version 3.12.3)
https://stackblitz.com/edit/github-um8mfw-zyx1rr

Link to project with expected (old) behaviour (version 3.5.3)
https://stackblitz.com/edit/github-um8mfw-pufiup

Describe the bug

On the first dev server startup in version 3.5.3, dependencies are optimized eagerly.
While in 3.12.3 dependencies are optimized lazily which may cause waterfall of page reloads significantly affecting developer experience.
This is a problem because:

  • it takes more time
  • page may reload after some delay (it seems like the page is ready to interaction, but then it reloads)

Each reload is accompanied by this message:

new dependencies optimized: X, Y
optimized dependencies changed. reloading

To confirm the issue you need to:

  1. delete node_modules/.cache directory
  2. run npm run dev and do NOT visit the page in browser
  3. once server is warmed up
    • 3.5.3 version - node_modules/.cache/vite/client/deps will contain optimized deps
    • 3.12.3 version - node_modules/.cache/vite/client/deps will not contain optimized deps
  4. visit "index" page
    • 3.5.3 version - no page reloads
    • 3.12.3 version - may be multiple page reloads

Additional context

No response

Logs

First load log from my project with this issue (look at timestamps)

  ➜ DevTools: press Shift + Option + D in the browser (v1.3.9)                                                                                5:26:20 PM

[5:26:20 PM]  WARN  Plugin /Users/.../platform/support/blanket-3/.nuxt/keycloak.d.ts is not wrapped in defineNuxtPlugin. It is advised to wrap your plugins as in the future this may enable enhancements.

ℹ Vite client warmed up in 2093ms                                                                                                            5:26:22 PM
✔ Nuxt Nitro server built in 1903 ms                                                                                                   nitro 5:26:22 PM
ℹ ✨ new dependencies optimized: @fe/ozi, axios, @fe/bonsai-logger-nuxt3, qs                                                                 5:26:26 PM
ℹ ✨ optimized dependencies changed. reloading                                                                                               5:26:26 PM

[5:26:28 PM]  WARN  Plugin /Users/.../platform/support/blanket-3/.nuxt/keycloak.d.ts is not wrapped in defineNuxtPlugin. It is advised to wrap your plugins as in the future this may enable enhancements.

ℹ ✨ new dependencies optimized: @fe/prop-types, @fe/icons-vue3                                                                              5:26:31 PM
ℹ ✨ optimized dependencies changed. reloading                                                                                               5:26:31 PM

[5:26:32 PM]  WARN  Plugin /Users/.../platform/support/blanket-3/.nuxt/keycloak.d.ts is not wrapped in defineNuxtPlugin. It is advised to wrap your plugins as in the future this may enable enhancements.

ℹ ✨ new dependencies optimized: is-what, @fe/nuxt3-graylog, @fe/nuxt3-sentry                                                                5:26:44 PM
ℹ ✨ optimized dependencies changed. reloading                                                                                               5:26:44 PM

[5:26:45 PM]  WARN  Plugin /Users/.../platform/support/blanket-3/.nuxt/keycloak.d.ts is not wrapped in defineNuxtPlugin. It is advised to wrap your plugins as in the future this may enable enhancements.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions