Skip to content

vite 6.0.0

6.0.0 (2024-11-26)

Vite 6 is out!

Today, we're taking another big step in Vite's story. The Vite team, contributors, and ecosystem partners are excited to announce the release of the next Vite major:

We want to thank the more than 1K contributors to Vite Core and the maintainers and contributors of Vite plugins, integrations, tools, and translations that have helped us craft this new major. We invite you to get involved and help us improve Vite for the whole ecosystem. Learn more at our Contributing Guide.

⚠ BREAKING CHANGES

  • drop node 21 support in version ranges (#18729)
  • deps: update dependency dotenv-expand to v12 (#18697)
  • resolve: allow removing conditions (#18395)
  • html: support more asset sources (#11138)
  • remove fs.cachedChecks option (#18493)
  • proxy bypass with WebSocket (#18070)
  • css: remove default import in ssr dev (#17922)
  • lib: use package name for css output file name (#18488)
  • update to chokidar v4 (#18453)
  • support file:// resolution (#18422)
  • deps: update postcss-load-config to v6 (#15235)
  • css: change default sass api to modern/modern-compiler (#17937)
  • css: load postcss config within workspace root only (#18440)
  • default build.cssMinify to 'esbuild' for SSR (#15637)
  • json: add json.stringify: 'auto' and make that the default (#18303)
  • bump minimal terser version to 5.16.0 (#18209)
  • deps: migrate fast-glob to tinyglobby (#18243)

Features

Bug Fixes

  • createRunnableDevEnvironment returns RunnableDevEnvironment, not DevEnvironment (#18673) (74221c3)
  • getModulesByFile should return a serverModule (#18715) (b80d5ec)
  • catch error in full reload handler (#18713) (a10e741)
  • client: overlay not appearing when multiple vite clients were loaded (#18647) (27d70b5)
  • deps: update all non-major dependencies (#18691) (f005461)
  • deps: update dependency dotenv-expand to v12 (#18697) (0c658de)
  • display pre-transform error details (#18764) (554f45f)
  • exit code on SIGTERM (#18741) (cc55e36)
  • expose missing InterceptorOptions type (#18766) (6252c60)
  • html: fix inline proxy modules invalidation (#18696) (8ab04b7)
  • log error when send in module runner failed (#18753) (ba821bb)
  • module-runner: make evaluator optional (#18672) (fd1283f)
  • optimizer: detect npm / yarn / pnpm dependency changes correctly (#17336) (#18560) (818cf3e)
  • optimizer: trigger onCrawlEnd after manual included deps are registered (#18733) (dc60410)
  • optimizer: workaround firefox's false warning for no sources source map (#18665) (473424e)
  • ssr: replace __vite_ssr_identity__ with (0, ...) and inject ; between statements (#18748) (94546be)
  • cjs build for perEnvironmentState et al (#18656) (95c4b3c)
  • html: externalize rollup.external scripts correctly (#18618) (55461b4)
  • include more modules to prefix-only module list (#18667) (5a2103f)
  • ssr: format ssrTransform parse error (#18644) (d9be921)
  • ssr: preserve fetchModule error details (#18626) (866a433)
  • browser field should not be included by default for consumer: 'server' (#18575) (87b2347)
  • client: detect ws close correctly (#18548) (637d31b)
  • resolve: run ensureVersionQuery for SSR (#18591) (63207e5)
  • use server.perEnvironmentStartEndDuringDev (#18549) (fe30349)
  • allow nested dependency selector to be used for optimizeDeps.include for SSR (#18506) (826c81a)
  • asset new URL(,import.meta.url) match (#18194) (5286a90)
  • close watcher if it's disabled (#18521) (85bd0e9)
  • config: write temporary vite config to node_modules (#18509) (72eaef5)
  • css: cssCodeSplit uses the current environment configuration (#18486) (eefe895)
  • json: don't json.stringify arrays (#18541) (fa50b03)
  • less: prevent rebasing [@import](https://github.com/import) url(...) (#17857) (aec5fdd)
  • lib: only resolve css bundle name if have styles (#18530) (5d6dc49)
  • scss: improve error logs (#18522) (3194a6a)
  • define in environment config was not working (#18515) (052799e)
  • build: apply resolve.external/noExternal to server environments (#18495) (5a967cb)
  • config: remove error if require resolve to esm (#18437) (f886f75)
  • consider URLs with any protocol to be external (#17369) (a0336bd)
  • css: remove default import in ssr dev (#17922) (eccf663)
  • use picomatch to align with tinyglobby (#18503) (437795d)
  • css: cssCodeSplit in environments.xxx.build is invalid (#18464) (993e71c)
  • css: make sass types work with sass-embedded (#18459) (89f8303)
  • deps: update all non-major dependencies (#18484) (2ec12df)
  • handle warmup glob hang (#18462) (409fa5c)
  • manifest: non entry CSS chunk src was wrong (#18133) (c148676)
  • module-runner: delay function eval until module runner instantiation (#18480) (472afbd)
  • plugins: noop if config hook returns same config reference (#18467) (bd540d5)
  • return the same instance of ModuleNode for the same EnvironmentModuleNode (#18455) (5ead461)
  • set scripts imported by HTML moduleSideEffects=true (#18411) (2ebe4b4)
  • use websocket to test server liveness before client reload (#17891) (7f9f8c6)
  • add typing to CSSOptions.preprocessorOptions (#18001) (7eeb6f2)
  • default build.cssMinify to 'esbuild' for SSR (#15637) (f1d3bf7)
  • dev: prevent double URL encoding in server.open on macOS (#18443) (56b7176)
  • preview: set resolvedUrls null after close (#18445) (65014a3)
  • ssr: inject identity function at the top (#18449) (0ab20a3)
  • ssr: preserve source maps for hoisted imports (fix #16355) (#16356) (8e382a6)
  • augment hash for CSS files to prevent chromium erroring by loading previous files (#18367) (a569f42)
  • cli: --watch should not override build.watch options (#18390) (b2965c8)
  • css: don't transform sass function calls with namespace (#18414) (dbb2604)
  • deps: update open dependency to 10.1.0 (#18349) (5cca4bf)
  • deps: update all non-major dependencies (#18345) (5552583)
  • more robust plugin.sharedDuringBuild (#18351) (47b1270)
  • ssr: this in exported function should be undefined (#18329) (bae6a37)
  • worker: rewrite rollup output.format with worker.format on worker build error (#18165) (dc82334)
  • injectQuery double encoding (#18246) (2c5f948)
  • add position to import analysis resolve exception (#18344) (0fe95d4)
  • assets: make srcset parsing HTML spec compliant (#16323) (#18242) (0e6d4a5)
  • css: dont remove JS chunk for pure CSS chunk when the export is used (#18307) (889bfc0)
  • deps: bump tsconfck (#18322) (67783b2)
  • deps: update all non-major dependencies (#18292) (5cac054)
  • destroy the runner when runnable environment is closed (#18282) (5212d09)
  • handle yarn command fail when root does not exist (#18141) (460aaff)
  • hmr: don't try to rewrite imports for direct CSS soft invalidation (#18252) (a03bb0e)
  • make it easier to configure environment runner (#18273) (fb35a78)
  • middleware-mode: call all hot.listen when server restart (#18261) (007773b)
  • optimizer: don't externalize transitive dep package name with asset extension (#18152) (fafc7e2)
  • resolve: fix resolve cache key for external conditions (#18332) (93d286c)
  • resolve: fix resolve cache to consider conditions and more (#18302) (2017a33)
  • types: add more overload to defineConfig (#18299) (94e34cf)
  • asset import should skip handling data URIs (#18163) (70813c7)
  • cache the runnable environment module runner (#18215) (95020ab)
  • call this.hot.close for non-ws HotChannel (#18212) (bad0ccc)
  • close HotChannel on environment close (#18206) (2d148e3)
  • config: treat all files as ESM on deno (#18081) (c1ed8a5)
  • css: ensure sass compiler initialized only once (#18128) (4cc5322)
  • css: fix lightningcss dep url resolution with custom root (#18125) (eb08f60)
  • css: fix missing source file warning with sass modern api custom importer (#18113) (d7763a5)
  • data-uri: only match ids starting with data: (#18241) (ec0efe8)
  • deps: update all non-major dependencies (#18170) (c8aea5a)
  • deps: upgrade rollup 4.22.4+ to ensure avoiding XSS (#18180) (ea1d0b9)
  • html: make build-html plugin work with sharedPlugins (#18214) (34041b9)
  • mixedModuleGraph: handle undefined id in getModulesByFile (#18201) (768a50f)
  • optimizer: re-optimize when changing config webCompatible (#18221) (a44b0a2)
  • require serialization for HMRConnection.send on implementation side (#18186) (9470011)
  • ssr: fix source map remapping with multiple sources (#18150) (e003a2c)
  • use config.consumer instead of options?.ssr / config.build.ssr (#18140) (21ec1ce)
  • vite: refactor "module cache" to "evaluated modules", pass down module to "runInlinedModule" (#18092) (e83beff)
  • avoid DOM Clobbering gadget in getRelativeUrlFromDocument (#18115) (ade1d89)
  • fs raw query (#18112) (9d2413c)
  • preload: throw error preloading module as well (#18098) (ba56cf4)
  • allow scanning exports from script module in svelte (#18063) (7d699aa)
  • build: declare preload-helper has no side effects (#18057) (587ad7b)
  • css: fallback to mainthread if logger or pkgImporter option is set for sass (#18071) (d81dc59)
  • dynamicImportVars: correct glob pattern for paths with parentheses (#17940) (2a391a7)
  • ensure req.url matches moduleByEtag URL to avoid incorrect 304 (#17997) (abf04c3)
  • html: escape html attribute (#18067) (5983f36)
  • incorrect environment consumer option resolution (#18079) (0e3467e)
  • preload: allow ignoring dep errors (#18046) (3fb2889)
  • store backwards compatible ssrModule and ssrError (#18031) (cf8ced5)

Performance Improvements

  • reduce bundle size for Object.keys(import.meta.glob(...)) / Object.values(import.meta.glob(...)) (#18666) (ed99a2c)
  • worker: inline worker without base64 (#18752) (90c66c9)
  • remove strip-ansi for a node built-in (#18630) (5182272)
  • css: skip style.css extraction if code-split css (#18470) (34fdb6b)
  • call module.enableCompileCache() (#18323) (18f1dad)
  • use crypto.hash when available (#18317) (2a14884)

Documentation

Reverts

Miscellaneous Chores

Code Refactoring

Build System

Tests

Beta Changelogs