-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
Problem
Vite's automatic dependency optimization causes disruptive "optimized dependencies changed. reloading" messages that severely impact development workflows:
- CI/CD Testing: Playwright/Cypress tests fail with ECONNRESET errors or freeze when dependencies optimize mid-test
- Local Package Development: Virtual links (pnpm/npm link) get overridden, breaking monorepo workflows
- Complex Applications: Apps with many pages/routes trigger endless reloads as each page imports new dependencies during manual testing
- Debugging Sessions: Unexpected reloads cause loss of application state
Developers need control over when optimization happens to avoid it when unnecessary.
Proposed Solution
Add a CLI flag to disable Vite's dependency optimization:
nuxt dev --suppress-dependency-optimizationThis would set vite.optimizeDeps.disabled = true internally.
Use Cases
E2E Testing:
nuxt dev --suppress-dependency-optimization & npm run test:e2eTesting Complex Apps:
# Navigate through all pages without constant reloads
nuxt dev --suppress-dependency-optimizationMonorepo Development:
# Preserve linked local packages
nuxt dev --suppress-dependency-optimizationWhy This Matters
- Current workaround requires manually listing all dependencies in
vite.optimizeDeps.include- impractical for large apps - Optimization is helpful for production but often unnecessary during active development
- Developers should control when optimization occurs, not be forced into it
Implementation
Non-breaking opt-in flag that passes through to existing Vite configuration. Simple addition to the dev command args.
Would the team accept a PR for this feature?
Related: #27700, nuxt/nuxt#26783, nuxt/nuxt#27372
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.
stormik
Metadata
Metadata
Assignees
Labels
No labels