Change8

v7.0.0

Breaking Changes
📦 viteView on GitHub →
5 breaking4 features🐛 4 fixes3 deprecations🔧 7 symbols

Summary

Vite 7 introduces the experimental Environment API for better SSR support and completes the transition to an ESM-first ecosystem while dropping support for older Node.js versions.

⚠️ Breaking Changes

  • Vite 7 now requires Node.js 18.20.0+, 20.9.0+, or 22.0.0+.
  • The CJS build of Vite is deprecated; users should migrate to ESM.
  • The default value for 'resolve.conditions' now includes 'module' by default.
  • CSS is now injected into the DOM using a different mechanism that may affect order-dependent styles.
  • The 'server.hmr.overlay' option now defaults to false in certain CI environments.

Migration Steps

  1. Convert vite.config.js to vite.config.mjs or set 'type': 'module' in package.json.
  2. Review CSS imports if relying on specific injection order.
  3. Update all @vitejs/plugin-* packages to their corresponding v7 versions.

✨ New Features

  • Environment API: A new experimental API to support multiple environments (e.g., SSR, Worklets) simultaneously.
  • Improved CSS performance and support for Lightning CSS as an alternative transformer.
  • Enhanced HMR (Hot Module Replacement) reliability and speed.
  • Support for TypeScript 5.x features and improved type checking performance.

🐛 Bug Fixes

  • Fixed various race conditions in the dev server startup.
  • Resolved issues with circular dependencies in optimized dependencies.
  • Fixed CSS source map generation in nested build scenarios.
  • Corrected behavior of 'base' path handling in multi-page applications.

🔧 Affected Symbols

createServerbuildresolveConfigCSSOptionsEnvironmentModuleGraphHMRContext

⚡ Deprecations

  • CommonJS API usage is deprecated in favor of ESM.
  • The 'ssr.external' and 'ssr.noExternal' options have refined behaviors; old patterns may trigger warnings.
  • Legacy support for older browsers via @vitejs/plugin-legacy requires specific version updates.