vitejs/vite
Compare Source
- fix: importmap should insert before module preload link (#11492) (25c64d7), closes#11492
- fix: server.host with ipv6 missed [] (fix#11466) (#11509) (2c38bae), closes#11466#11509
- fix: stop considering parent URLs as public file (#11145) (568a014), closes#11145
- fix(build): invalidate chunk hash when css changed (#11475) (7a97a04), closes#11475
- fix(cli): ctrl+C no longer kills processes (#11434) (#11518) (718fc1d), closes#11434#11518
- fix(cli): revert ctrl+C no longer kills processes (#11434) (#11518) (#11562) (3748acb), closes#11434#11518#11562
- fix(optimizer): check .vite/deps directory existence before removing (#11499) (1b043f9), closes#11499
- fix(ssr): emit js sourcemaps for ssr builds (#11343) (f12a1ab), closes#11343
- chore: update license (#11476) (3d346c0), closes#11476
- chore(deps): update dependency@rollup/plugin-json to v6 (#11553) (3647d07), closes#11553
Compare Source
Compare Source
Compare Source
- feat: show server url by pressing
u (#11319) (8c0bb7b), closes#11319 - feat(html): clickable error position for html parse error (#11334) (2e15f3d), closes#11334
- fix: ?inline warning for .css.js file (#11347) (729fb1a), closes#11347
- fix: check if build exists so preview doesn't show 404s due to nonexistent build (#10564) (0a1db8c), closes#10564
- fix: derive
useDefineForClassFields value fromtsconfig.compilerOptions.target (fixes#10296) (# (42976d8), closes#10296#11301 - fix: preview fallback (#11312) (cfedf9c), closes#11312
- fix: respect base when using
/__open-in-editor (#11337) (8856c2e), closes#11337 - fix: wrongly resolve to optimized doppelganger (#11290) (34fec41), closes#11290
- fix(env): test NODE_ENV override before expand (#11309) (d0a9281), closes#11309
- fix(preview): Revert#10564 - throw Error on missing outDir (#11335) (3aaa0ea), closes#10564#11335#10564
- docs: fix banner image in CHANGELOG.md (#11336) (45b66f4), closes#11336
- chore: enable
@typescript-eslint/ban-ts-comment (#11326) (e58a4f0), closes#11326 - chore: fix format (#11311) (9c2b1c0), closes#11311
- chore: update changelog release notes for 4.0 (#11285) (83abd37), closes#11285
- chore(deps): update all non-major dependencies (#11321) (dcc0004), closes#11321
- chore(esbuild): add test for configuration overrides (#11267) (f897b64), closes#11267
Compare Source

Read the announcement blog post:Announcing Vite 4
Quick links:
Docs in other languages:
Main Changes
This major is smaller in scope compared to Vite 3, with the main objective of upgrading to Rollup 3. We've worked with the ecosystem to ensure a smooth upgrade path for this new major.
Rollup 3
Vite is now usingRollup 3, which allowed us to simplify Vite's internal asset handling and has many improvements. See theRollup 3 release notes here.
Framework Plugins out of the Vite core monorepo
@vitejs/plugin-vue and@vitejs/plugin-react have been part of Vite core monorepo since the first versions of Vite. This helped us to get a close feedback loop when making changes as we were getting both Core and the plugins tested and released together. Withvite-ecosystem-ci we can get this feedback with these plugins developed on independent repositories, so from Vite 4,they have been moved out of the Vite core monorepo. This is meaningful for Vite's framework-agnostic story, and will allow us to build independent teams to maintain each of the plugins. If you have bugs to report or features to request, please create issues on the new repositories moving forward:vitejs/vite-plugin-vue andvitejs/vite-plugin-react.
New React plugin using SWC during development
SWC is now a mature replacement forBabel, especially in the context of React projects. SWC's React Fast Refresh implementation is a lot faster than Babel, and for some projects, it is now a better alternative. From Vite 4, two plugins are available for React projects with different tradeoffs. We believe that both approaches are worth supporting at this point, and we'll continue to explore improvements to both plugins in the future.
@vitejs/plugin-react is a plugin that uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the babel transform pipeline.
@vitejs/plugin-react-swc is a new plugin that uses esbuild during build, but replaces Babel with SWC during development. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster.
Compatibility
The modern browser build now targetssafari14 by default for wider ES2020 compatibility (https://github.com/vitejs/vite/issues/9063). This means that modern builds can now useBigInt and that thenullish coallessing operator isn't transpiled anymore. If you need to support older browsers, you can add@vitejs/plugin-legacy as usual.
Importing CSS as a string
In Vite 3, importing the default export of a.css file could introduce a double loading of CSS.
importcssStringfrom'./global.css';
This double loading could occur since a.css file will be emitted and it's likely that the CSS string will also be used by the application code — for example, injected by the framework runtime. From Vite 4, the.css default exporthas been deprecated. The?inline query suffix modifier needs to be used in this case, as that doesn't emit the imported.css styles.
importstufffrom'./global.css?inline'
Other features
- Support for patch-package when pre bundling dependencies (#10286)
- Cleaner build logs output (#10895) and switch to
kB to align with browser dev tools (#10982) - Improved error messages during SSR (#11156)
Features
- feat: add CLI keyboard shortcuts (#11228) (87973f1), closes#11228
- feat: export error message generator (#11155) (493ba1e), closes#11155
- feat(node/plugins): esbuild options (#11049) (735b98b), closes#11049
- feat: improve the error message of
expand (#11141) (825c793), closes#11141 - feat: update@types/node to v18 (#11195) (4ec9f53), closes#11195
- feat(client)!: remove never implemented hot.decline (#11036) (e257e3b), closes#11036
- feat!: support
safari14 by default for wider ES2020 compatibility (#9063) (3cc65d7), closes#9063 - feat!: support multiline values in env files (#10826) (606e60d), closes#10826
- feat(ssr)!: remove dedupe and mode support for CJS (#11101) (3090564), closes#11101
- feat: align object interface for
transformIndexHtml hook (#9669) (1db52bf), closes#9669 - feat(build): cleaner logs output (#10895) (7d24b5f), closes#10895
- feat(css): deprecate css default export (#11094) (01dee1b), closes#11094
- feat(optimizer): support patch-package (#10286) (4fb7ad0), closes#10286
- feat(build): Use kB in build reporter (#10982) (b57acfa), closes#10982
- feat(css): upgrade postcss-modules (#10987) (892916d), closes#10987
- feat(hmr): invalidate message (#10946) (0d73473), closes#10946
- feat(client): expose hot.prune API (#11016) (f40c18d), closes#11016
- feat(hmr): deduplicate paths and join them with commas (#10891) (967299a), closes#10891
- feat: base without trailing slash (#10723) (8f87282), closes#10723
- feat: handle static assets in case-sensitive manner (#10475) (c1368c3), closes#10475
- feat(cli): build --profile (#10719) (9c808cd), closes#10719
- feat(env): support dotenv-expand to contains process env (#10370) (d5fe92c), closes#10370
- feat!: set esbuild default charset to utf8 (#10753) (4caf4b6), closes#10753
- feat: rollup 3 (#9870) (beb7166), closes#9870
Bug Fixes
- fix: add
\0 to virtual files id (#11261) (02cdfa9), closes#11261 - fix: skip shortcuts on non-tty stdin (#11263) (9602686), closes#11263
- fix(ssr): skip rewriting stack trace if it's already rewritten (fixes#11037) (#11070) (feb8ce0), closes#11037#11070
- refactor(optimizer): await depsOptimizer.scanProcessing (#11251) (fa64c8e), closes#11251
- fix: improve CLI shortcuts help display (#11247) (bb235b2), closes#11247
- fix: less promises for scanning and await with allSettled (#11245) (45b170e), closes#11245
- fix(optimizer): escape entrypoints when running scanner (#11250) (b61894e), closes#11250
- fix: await scanner (#11242) (52a6732), closes#11242
- fix(css): fix css lang regex (#11237) (a55d0b3), closes#11237
- fix: don't print urls on restart with default port (#11230) (5aaecb6), closes#11230
- fix: serialize bundleWorkerEntry (#11218) (306bed0), closes#11218
- fix(config): resolve dynamic import as esm (#11220) (f8c1ed0), closes#11220
- fix(env): prevent env expand on process.env (#11213) (d4a1e2b), closes#11213
- fix: add type for function localsConvention value (#11152) (c9274b4), closes#11152
- fix: cacheDir should be ignored from watch (#10242) (75dbca2), closes#10242
- fix: don't check .yarn/patches for computing dependencies hash (#11168) (65bcccf), closes#11168
- fix: formatError() outside rollup context (#11156) (2aee2eb), closes#11156
- fix: Revert "fix: missing js sourcemaps with rewritten imports broke debugging (#7767) (#9476)" (#11 (fdc6f3a), closes#7767#9476#11144
- fix: Dev SSR dep optimization + respect optimizeDeps.include (#11123) (515caa5), closes#11123
- fix: export preprocessCSS in CJS (#11067) (793255d), closes#11067
- fix: glob import parsing (#10949) (#11056) (ac2cfd6), closes#10949#11056
- fix: import.meta.env and process.env undefined variable replacement (fix#8663) (#10958) (3e0cd3d), closes#8663#10958
- fix: missing js sourcemaps with rewritten imports broke debugging (#7767) (#9476) (3fa96f6), closes#7767#9476
- fix: preserve default export from externalized packages (fixes#10258) (#10406) (88b001b), closes#10258#10406
- fix: reset global regex before match (#11132) (db8df14), closes#11132
- fix(css): handle environment with browser globals (#11079) (e92d025), closes#11079
- fix(deps): update all non-major dependencies (#11091) (073a4bf), closes#11091
- fix(esbuild): handle inline sourcemap option (#11120) (4c85c0a), closes#11120
- fix(importGlob): don't warn when CSS default import is not used (#11121) (97f8b4d), closes#11121
- fix(importGlob): preserve line count for sourcemap (#11122) (14980a1), closes#11122
- fix(importGlob): warn on default import css (#11103) (fc0d9e3), closes#11103
- fix(plugin-vue): support scss/sass/less... hmr on custom template languages (fix#10677) (#10844) (d413848), closes#10677#10844
- fix(ssr): preserve require for external node (#11057) (1ec0176), closes#11057
- fix(worker): disable build reporter plugin when bundling worker (#11058) (7b72069), closes#11058
- fix!: make
NODE_ENV more predictable (#10996) (8148af7), closes#10996 - fix(config)!: support development build (#11045) (8b3d656), closes#11045
- refactor: use function to eval worker and glob options (#10999) (f4c1264), closes#10999
- refactor(client): simplify fetchUpdate code (#11004) (f777b55), closes#11004
- fix(html): transform relative path with long base in /index.html (#10990) (752740c), closes#10990
- fix(mpa): support mpa fallback (#10985) (61165f0), closes#10985
- feat: align default chunk and asset file names with rollup (#10927) (cc2adb3), closes#10927
- fix: make
addWatchFile() work (fix#7024) (#9723) (34db08b), closes#7024#9723 - fix(config): exclude config.assetsInclude empty array (#10941) (18c71dc), closes#10941
- fix(ssr): skip optional peer dep resolve (#10593) (0a69985), closes#10593
- perf: regexp perf issues, refactor regexp stylistic issues (#10905) (fc007df), closes#10905
- refactor: move CSS emitFile logic closer to rollup (#10909) (92a206b), closes#10909
- refactor: use rollup hashing when emitting assets (#10878) (78c77be), closes#10878
- fix: don't throw on malformed URLs (#10901) (feb9b10), closes#10901
- fix: gracefully handle forbidden filesystem access (#10793) (92637a2), closes#10793
- fix(types): remove
null fromCSSModulesOptions.localsConvention (#10904) (a9978dd), closes#10904 - refactor(types)!: remove facade type files (#10903) (a309058), closes#10903
- fix: inconsistent handling of non-ASCII
base inresolveConfig and dev server (#10247) (16e4123), closes#10247 - fix: prevent cache on optional package resolve (#10812) (c599a2e), closes#10812
- fix: relocated logger to respect config. (#10787) (52e64eb), closes#10787
- fix: throw missing name error only when 'umd' or 'iife' are used (#9886) (b8aa825), closes#9886
- fix(deps): update all non-major dependencies (#10804) (f686afa), closes#10804
- fix(ssr): improve missing file error (#10880) (5451a34), closes#10880
Previous Changelogs
See4.0.0-beta.7 changelog
See4.0.0-beta.6 changelog
See4.0.0-beta.5 changelog
See4.0.0-beta.4 changelog
See4.0.0-beta.3 changelog
See4.0.0-beta.2 changelog
See4.0.0-beta.1 changelog
See4.0.0-beta.0 changelog
See4.0.0-alpha.6 changelog
See4.0.0-alpha.5 changelog
See4.0.0-alpha.4 changelog
See4.0.0-alpha.3 changelog
See4.0.0-alpha.2 changelog
See4.0.0-alpha.1 changelog
See4.0.0-alpha.0 changelog
Uh oh!
There was an error while loading.Please reload this page.
This PR contains the following updates:
^3.1.6->^4.0.0Release Notes
vitejs/vite
v4.0.4Compare Source
v4.0.3Compare Source
v4.0.2Compare Source
toOutputFilePathWithoutRuntimefunction (#11367) (8820f75), closes#11367vite optimizeprebundle for dev (#11387) (b4ced0f), closes#11387v4.0.1Compare Source
u(#11319) (8c0bb7b), closes#11319useDefineForClassFieldsvalue fromtsconfig.compilerOptions.target(fixes#10296) (# (42976d8), closes#10296#11301/__open-in-editor(#11337) (8856c2e), closes#11337@typescript-eslint/ban-ts-comment(#11326) (e58a4f0), closes#11326v4.0.0Compare Source
Read the announcement blog post:Announcing Vite 4
Quick links:
Docs in other languages:
Main Changes
This major is smaller in scope compared to Vite 3, with the main objective of upgrading to Rollup 3. We've worked with the ecosystem to ensure a smooth upgrade path for this new major.
Rollup 3
Vite is now usingRollup 3, which allowed us to simplify Vite's internal asset handling and has many improvements. See theRollup 3 release notes here.
Framework Plugins out of the Vite core monorepo
@vitejs/plugin-vueand@vitejs/plugin-reacthave been part of Vite core monorepo since the first versions of Vite. This helped us to get a close feedback loop when making changes as we were getting both Core and the plugins tested and released together. Withvite-ecosystem-ci we can get this feedback with these plugins developed on independent repositories, so from Vite 4,they have been moved out of the Vite core monorepo. This is meaningful for Vite's framework-agnostic story, and will allow us to build independent teams to maintain each of the plugins. If you have bugs to report or features to request, please create issues on the new repositories moving forward:vitejs/vite-plugin-vueandvitejs/vite-plugin-react.New React plugin using SWC during development
SWC is now a mature replacement forBabel, especially in the context of React projects. SWC's React Fast Refresh implementation is a lot faster than Babel, and for some projects, it is now a better alternative. From Vite 4, two plugins are available for React projects with different tradeoffs. We believe that both approaches are worth supporting at this point, and we'll continue to explore improvements to both plugins in the future.
@vitejs/plugin-react
@vitejs/plugin-react is a plugin that uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the babel transform pipeline.
@vitejs/plugin-react-swc (new)
@vitejs/plugin-react-swc is a new plugin that uses esbuild during build, but replaces Babel with SWC during development. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster.
Compatibility
The modern browser build now targets
safari14by default for wider ES2020 compatibility (https://github.com/vitejs/vite/issues/9063). This means that modern builds can now useBigIntand that thenullish coallessing operator isn't transpiled anymore. If you need to support older browsers, you can add@vitejs/plugin-legacyas usual.Importing CSS as a string
In Vite 3, importing the default export of a
.cssfile could introduce a double loading of CSS.This double loading could occur since a
.cssfile will be emitted and it's likely that the CSS string will also be used by the application code — for example, injected by the framework runtime. From Vite 4, the.cssdefault exporthas been deprecated. The?inlinequery suffix modifier needs to be used in this case, as that doesn't emit the imported.cssstyles.Other features
kBto align with browser dev tools (#10982)Features
expand(#11141) (825c793), closes#11141safari14by default for wider ES2020 compatibility (#9063) (3cc65d7), closes#9063transformIndexHtmlhook (#9669) (1db52bf), closes#9669Bug Fixes
\0to virtual files id (#11261) (02cdfa9), closes#11261NODE_ENVmore predictable (#10996) (8148af7), closes#10996addWatchFile()work (fix#7024) (#9723) (34db08b), closes#7024#9723nullfromCSSModulesOptions.localsConvention(#10904) (a9978dd), closes#10904baseinresolveConfigand dev server (#10247) (16e4123), closes#10247Previous Changelogs
4.0.0-beta.7 (2022-12-08)
See4.0.0-beta.7 changelog
4.0.0-beta.6 (2022-12-08)
See4.0.0-beta.6 changelog
4.0.0-beta.5 (2022-12-08)
See4.0.0-beta.5 changelog
4.0.0-beta.4 (2022-12-07)
See4.0.0-beta.4 changelog
4.0.0-beta.3 (2022-12-07)
See4.0.0-beta.3 changelog
4.0.0-beta.2 (2022-12-07)
See4.0.0-beta.2 changelog
4.0.0-beta.1 (2022-12-06)
See4.0.0-beta.1 changelog
4.0.0-beta.0 (2022-12-05)
See4.0.0-beta.0 changelog
4.0.0-alpha.6 (2022-11-30)
See4.0.0-alpha.6 changelog
4.0.0-alpha.5 (2022-11-22)
See4.0.0-alpha.5 changelog
4.0.0-alpha.4 (2022-11-17)
See4.0.0-alpha.4 changelog
4.0.0-alpha.3 (2022-11-15)
See4.0.0-alpha.3 changelog
4.0.0-alpha.2 (2022-11-13)
See4.0.0-alpha.2 changelog
4.0.0-alpha.1 (2022-11-12)
See4.0.0-alpha.1 changelog
4.0.0-alpha.0 (2022-11-07)
See4.0.0-alpha.0 changelog
Configuration
📅Schedule: Branch creation - "before 3am on Monday" (UTC), Automerge - At any time (no schedule defined).
🚦Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated byMend Renovate. View repository job loghere.