Skip to content
Permalink
main
Switch branches/tags
Go to file
13 contributors

Users who have contributed to this file

@patak-dev @yyx990803 @antfu @bluwy @xjh22222228 @val1984 @Kocal @sapphi-red @web2033 @AndrejsAbrickis @zheeeng @gllxl
3546 lines (2025 sloc) 281 KB

3.0.0-beta.2 (2022-06-24)

  • feat: enable tree-shaking for lib es (#8737) (5dc0f72), closes #8737
  • feat: supports cts and mts config (#8729) (c2b09db), closes #8729
  • fix: avoid type mismatch with Rollup (fix #7843) (#8701) (87e51f7), closes #7843 #8701
  • fix: optimizeDeps.entries transformRequest url (fix #8719) (#8748) (9208c3b), closes #8719 #8748
  • fix(hmr): HMR_PORT should not be 'undefined' (#8761) (3271266), closes #8761
  • perf(lib): improve helper inject regex (#8741) (19fc7e5), closes #8741
  • refactor: remove unnecessary condition (#8742) (2ae269e), closes #8742
  • docs: fix alpha changelog links (#8736) (31348b5), closes #8736
  • chore: v3 beta release notes (#8718) (7e899d0), closes #8718

3.0.0-beta.1 (2022-06-22)

Main Changes

  • New docs theme using VitePress v1 alpha: https://main.vitejs.dev
  • Vite CLI
    • The default dev server port is now 5173, with the preview server starting at 4173.
    • The default dev server host is now localhost instead of 127.0.0.1.
  • Compatibility
    • Vite no longer supports Node v12, which reached its EOL. Node 14.18+ is now required.
    • Vite is now published as ESM, with a CJS proxy to the ESM entry for compatibility.
    • The Modern Browser Baseline now targets browsers which support the native ES Modules and native ESM dynamic import and import.meta.
    • JS file extensions in SSR and lib mode now use a valid extension (js, mjs, or cjs) for output JS entries and chunks based on their format and the package type.
  • Architecture changes
    • Vite no longer pre-scans user code with esbuild to get an initial list of dependencies on cold start. Instead, it delays the first dependency optimization run until every imported user module on load is processed.
    • Vite now uses esbuild to optimize dependencies avoiding the need of@rollupjs/plugin-commonjs, removing one of the most significant differences between dev and prod present in v2.
    • Vite uses ESM for the SSR build by default, and previous SSR externalization heuristics are no longer needed.
  • import.meta.glob has been improved, read about the new features in the Glob Import Guide
  • The WebAssembly import API has been revised to avoid collisions with future standards. Read more in the WebAssembly guide
  • Improved support for relative base.
  • Experimental Features
  • Terser is now an optional dependency to reduce the bundle size. If you use build.minify: 'terser', you'll need to install it (npm add -D terser)
  • Options that were already deprecated in v2 have been removed.

Note Before updating, check out the migration guide from v2

Features

  • feat: bump minimum node version to 14.18.0 (#8662) (8a05432), closes #8662
  • feat: experimental.buildAdvancedBaseOptions (#8450) (8ef7333), closes #8450
  • feat: export esbuildVersion and rollupVersion (#8675) (15ebe1e), closes #8675
  • feat: print resolved address for localhost (#8647) (eb52d36), closes #8647
  • feat(hmr): experimental.hmrPartialAccept (#7324) (83dab7e), closes #7324
  • refactor: type client maps (#8626) (cf87882), closes #8626
  • feat: cleaner default dev output (#8638) (dbd9688), closes #8638
  • feat: legacy options to revert to v2 strategies (#8623) (993b842), closes #8623
  • feat: support async plugins (#8574) (caa8a58), closes #8574
  • feat: support cjs noExternal in SSR dev, fix #2579 (#8430) (11d2191), closes #2579 #8430
  • feat(dev): added assets to manifest (#6649) (cdf744d), closes #6649
  • feat!: appType (spa, mpa, custom), boolean middlewareMode (#8452) (14db473), closes #8452
  • feat: 500 response if the node proxy request fails (#7398) (73e1775), closes #7398
  • feat: expose createFilter util (#8562) (c5c424a), closes #8562
  • feat: better config __dirname support (#8442) (51e9195), closes #8442
  • feat: expose version (#8456) (e992594), closes #8456
  • feat: handle named imports of builtin modules (#8338) (e2e44ff), closes #8338
  • feat: preserve process env vars in lib build (#8090) (908c9e4), closes #8090
  • refactor!: make terser an optional dependency (#8049) (164f528), closes #8049
  • chore: resolve ssr options (#8455) (d97e402), closes #8455
  • perf: disable postcss sourcemap when unused (#8451) (64fc61c), closes #8451
  • feat: add ssr.format to force esm output for ssr (#6812) (337b197), closes #6812
  • feat: default esm SSR build, simplified externalization (#8348) (f8c92d1), closes #8348
  • feat: derive proper js extension from package type (#8382) (95cdd81), closes #8382
  • feat: ssr build using optimized deps (#8403) (6a5a5b5), closes #8403
  • refactor: ExportData.imports to ExportData.hasImports (#8355) (168de2d), closes #8355
  • feat: scan free dev server (#8319) (3f742b6), closes #8319
  • feat: non-blocking esbuild optimization at build time (#8280) (909cf9c), closes #8280
  • feat: non-blocking needs interop (#7568) (531cd7b), closes #7568
  • refactor(cli): improve output aesthetics (#6997) (809ab47), closes #6997
  • dx: sourcemap combine debug utils (#8307) (45dba50), closes #8307
  • feat: sourcemap for importAnalysis (#8258) (a4e4d39), closes #8258
  • feat: spa option, preview and dev for MPA and SSR apps (#8217) (d7cba46), closes #8217
  • feat: vite connected logs changed to console.debug (#7733) (9f00c41), closes #7733
  • feat: worker support query url (#7914) (95297dd), closes #7914
  • feat(wasm): new wasm plugin (.wasm?init) (#8219) (75c3bf6), closes #8219
  • build!: bump targets (#8045) (66efd69), closes #8045
  • feat!: migrate to ESM (#8178) (76fdc27), closes #8178
  • feat!: relative base (#7644) (09648c2), closes #7644
  • feat(css): warn if url rewrite has no importer (#8183) (0858450), closes #8183
  • feat: allow any JS identifier in define, not ASCII-only (#5972) (95eb45b), closes #5972
  • feat: enable generatedCode: 'es2015' for rollup build (#5018) (46d5e67), closes #5018
  • feat: rework dynamic-import-vars (#7756) (80d113b), closes #7756
  • feat: worker emit fileName with config (#7804) (04c2edd), closes #7804
  • feat(glob-import): support { import: '*' } (#8071) (0b78b2a), closes #8071
  • build!: remove node v12 support (#7833) (eeac2d2), closes #7833
  • feat!: rework import.meta.glob (#7537) (330e0a9), closes #7537
  • feat!: vite dev default port is now 5173 (#8148) (1cc2e2d), closes #8148
  • refactor: remove deprecated api for 3.0 (#5868) (b5c3709), closes #5868
  • chore: stabilize experimental api (#7707) (b902932), closes #7707
  • test: migrate to vitest (#8076) (8148f67), closes #8076

Bug Fixes

  • fix: respect rollupOptions.external for transitive dependencies (#8679) (4f9097b), closes #8679
  • fix: use esbuild platform browser/node instead of neutral (#8714) (a201cd4), closes #8714
  • fix: disable inlineDynamicImports for ssr.target = node (#8641) (3b41a8e), closes #8641
  • fix: infer hmr ws target by client location (#8650) (4061ee0), closes #8650
  • fix: non-relative base public paths in CSS files (#8682) (d11d6ea), closes #8682
  • fix: SSR with relative base (#8683) (c1667bb), closes #8683
  • fix: filter of BOM tags in json plugin (#8628) (e10530b), closes #8628
  • fix: revert #5902, fix #8243 (#8654) (1b820da), closes #8243 #8654
  • fix(optimizer): use simple browser external shim in prod (#8630) (a32c4ba), closes #8630
  • fix(server): skip localhost verbatim dns lookup (#8642) (7632247), closes #8642
  • fix(wasm): support inlined WASM in Node < v16 (fix #8620) (#8622) (f586b14), closes #8620 #8622
  • fix: allow cache overlap in parallel builds (#8592) (2dd0b49), closes #8592
  • fix: avoid replacing defines and NODE_ENV in optimized deps (fix #8593) (#8606) (739175b), closes #8593 #8606
  • fix: sequential injection of tags in transformIndexHtml (#5851) (#6901) (649c7f6), closes #5851 #6901
  • fix(asset): respect assetFileNames if rollupOptions.output is an array (#8561) (4e6c26f), closes #8561
  • fix(css): escape pattern chars from base path in postcss dir-dependency messages (#7081) (5151e74), closes #7081
  • fix(optimizer): browser mapping for yarn pnp (#6493) (c1c7af3), closes #6493
  • fix: add missed JPEG file extensions to KNOWN_ASSET_TYPES (#8565) (2dfc015), closes #8565
  • fix: default export module transformation for vitest spy (#8567) (d357e33), closes #8567
  • fix: default host to localhost instead of 127.0.0.1 (#8543) (49c0896), closes #8543
  • fix: dont handle sigterm in middleware mode (#8550) (c6f43dd), closes #8550
  • fix: mime missing extensions (#8568) (acf3024), closes #8568
  • fix: objurl for type module, and concurrent tests (#8541) (26ecd5a), closes #8541
  • fix: outdated optimized dep removed from module graph (#8533) (3f4d22d), closes #8533
  • fix(config): only rewrite .js loader in loadConfigFromBundledFile (#8556) (2548dd3), closes #8556
  • fix(deps): update all non-major dependencies (#8558) (9a1fd4c), closes #8558
  • fix(ssr): dont replace rollup input (#7275) (9a88afa), closes #7275
  • fix: deps optimizer idle logic for workers (fix #8479) (#8511) (1e05548), closes #8479 #8511
  • fix: not match \n when injecting esbuild helpers (#8414) (5a57626), closes #8414
  • fix: respect optimize deps entries (#8489) (fba82d0), closes #8489
  • fix(optimizer): encode _ and . in different way (#8508) (9065b37), closes #8508
  • fix(optimizer): external require-import conversion (fixes #2492, #3409) (#8459) (1061bbd), closes #2492 #3409 #8459
  • fix: make array acornInjectPlugins work (fixes #8410) (#8415) (08d594b), closes #8410 #8415
  • fix: SSR deep imports externalization (fixes #8420) (#8421) (89d6711), closes #8420 #8421
  • fix: import.meta.accept() -> import.meta.hot.accept() (#8361) (c5185cf), closes #8361
  • fix: return type of handleHMRUpdate (#8367) (79d5ce1), closes #8367
  • fix: sourcemap source point to null (#8299) (356b896), closes #8299
  • fix: ssr-manifest no base (#8371) (37eb5b3), closes #8371
  • fix(deps): update all non-major dependencies (#8391) (842f995), closes #8391
  • fix: preserve annotations during build deps optimization (#8358) (334cd9f), closes #8358
  • fix: missing types for es-module-lexer (fixes #8349) (#8352) (df2cc3d), closes #8349 #8352
  • fix(optimizer): transpile before calling transformGlobImport (#8343) (1dbc7cc), closes #8343
  • fix(deps): update all non-major dependencies (#8281) (c68db4d), closes #8281
  • fix: expose client dist in exports (#8324) (689adc0), closes #8324
  • fix(cjs): build cjs for loadEnv (#8305) (80dd2df), closes #8305
  • fix: correctly replace process.env.NODE_ENV (#8283) (ec52baa), closes #8283
  • fix: dev sourcemap (#8269) (505f75e), closes #8269
  • fix: glob types (#8257) (03b227e), closes #8257
  • fix: srcset handling in html (#6419) (a0ee4ff), closes #6419
  • fix: support set NODE_ENV in scripts when custom mode option (#8218) (adcf041), closes #8218
  • fix(hmr): catch thrown errors when connecting to hmr websocket (#7111) (4bc9284), closes #7111
  • fix(plugin-legacy): respect entryFileNames for polyfill chunks (#8247) (baa9632), closes #8247
  • fix(plugin-react): broken optimized deps dir check (#8255) (9e2a1ea), closes #8255
  • fix!: do not fixStacktrace by default (#7995) (23f8e08), closes #7995
  • fix(glob): properly handles tailing comma (#8181) (462be8e), closes #8181
  • fix: add hash to lib chunk names (#7190) (c81cedf), closes #7190
  • fix: allow css to be written for systemjs output (#5902) (780b4f5), closes #5902
  • fix: client full reload (#8018) (2f478ed), closes #8018
  • fix: handle optimize failure (#8006) (ba95a2a), closes #8006
  • fix: increase default HTTPS dev server session memory limit (#6207) (f895f94), closes #6207
  • fix: relative path html (#8122) (d0deac0), closes #8122
  • fix: Remove ssrError when invalidating a module (#8124) (a543220), closes #8124
  • fix: remove useless /__vite_ping handler (#8133) (d607b2b), closes #8133
  • fix: typo in #8121 (#8143) (c32e3ac), closes #8121 #8143
  • fix: use Vitest for unit testing, clean regex bug (#8040) (63cd53d), closes #8040
  • fix: Vite cannot load configuration files in the link directory (#4180) (#4181) (a3fa1a3), closes #4180 #4181
  • fix: vite client types (#7877) (0e67fe8), closes #7877
  • fix: warn for unresolved css in html (#7911) (2b58cb3), closes #7911
  • fix(build): use crossorigin for module preloaded (85cab70)
  • fix(client): wait on the socket host, not the ping host (#6819) (ae56e47), closes #6819
  • fix(css): hoist external @import for non-split css (#8022) (5280908), closes #8022
  • fix(css): preserve dynamic import css code (fix #5348) (#7746) (12d0cc0), closes #5348 #7746
  • fix(glob): wrap glob compile output in function invocation (#3682) (bb603d3), closes #3682
  • fix(lib): enable inlineDynamicImports for umd and iife (#8126) (272a252), closes #8126
  • fix(lib): use proper extension (#6827) (34df307), closes #6827
  • fix(ssr): avoid transforming json file in ssrTransform (#6597) (a709440), closes #6597
  • fix(lib)!: remove format prefixes for cjs and esm (#8107) (ad8c3b1), closes #8107

Previous Changelogs

3.0.0-beta.0 (2022-06-21)

See 3.0.0-beta.0 changelog

3.0.0-alpha.14 (2022-06-20)

See 3.0.0-alpha.14 changelog

3.0.0-alpha.13 (2022-06-19)

See 3.0.0-alpha.13 changelog

3.0.0-alpha.12 (2022-06-16)

See 3.0.0-alpha.12 changelog

3.0.0-alpha.11 (2022-06-14)

See 3.0.0-alpha.11 changelog

3.0.0-alpha.10 (2022-06-10)

See 3.0.0-alpha.10 changelog

3.0.0-alpha.9 (2022-06-01)

See 3.0.0-alpha.9 changelog

3.0.0-alpha.8 (2022-05-31)

See 3.0.0-alpha.8 changelog

3.0.0-alpha.7 (2022-05-27)

See 3.0.0-alpha.7 changelog

3.0.0-alpha.6 (2022-05-27)

See 3.0.0-alpha.6 changelog

3.0.0-alpha.5 (2022-05-26)

See 3.0.0-alpha.5 changelog

3.0.0-alpha.4 (2022-05-25)

See 3.0.0-alpha.4 changelog

3.0.0-alpha.3 (2022-05-25)

See 3.0.0-alpha.3 changelog

3.0.0-alpha.2 (2022-05-23)

See 3.0.0-alpha.2 changelog

3.0.0-alpha.1 (2022-05-18)

See 3.0.0-alpha.1 changelog

3.0.0-alpha.0 (2022-05-13)

See 3.0.0-alpha.0 changelog

2.9.12 (2022-06-10)

  • fix: outdated optimized dep removed from module graph (#8534) (c0d6c60), closes #8534

2.9.11 (2022-06-10)

  • fix: respect server.headers in static middlewares (#8481) (ab7dc1c), closes #8481
  • fix(dev): avoid FOUC when swapping out link tag (fix #7973) (#8495) (01fa807), closes #7973 #8495

2.9.10 (2022-06-06)

  • feat: treat Astro file scripts as TS (#8151) (9fdd0a3), closes #8151
  • feat: new hook configurePreviewServer (#7658) (#8437) (7b972bc), closes #7658 #8437
  • fix: remove empty chunk css imports when using esnext (#8345) (9fbc1a9), closes #8345
  • fix: EPERM error on Windows when processing dependencies (#8235) (dfe4307), closes #8235
  • fix(css): remove ?used hack (fixes #6421, #8245) (#8278) (#8471) (8d7bac4), closes #6421 #8245 #8278 #8471
  • chore(lint): sort for imports (#8113) (4bd1531), closes #8113

2.9.9 (2022-05-11)

  • fix: add direct query to html-proxy css (fixes #8091) (#8094) (a24b5e3), closes #8091 #8094
  • fix: graceful rename in windows (#8036) (84496f8), closes #8036
  • fix: image-set with base64 images (fix #8028) (#8035) (992aee2), closes #8028 #8035
  • fix: invalidate ssrError when HMR update occurs (#8052) (22fa882), closes #8052
  • fix: use strip-literal to strip string lterals (#8054) (b6fc3cd), closes #8054
  • perf(lib): reduce backtrack when injecting esbuild helpers (#8110) (e5556ab), closes #8110

2.9.8 (2022-05-04)

  • fix: inline js and css paths for virtual html (#7993) (d49e3fb), closes #7993
  • fix: only handle merge ssr.noExternal (#8003) (642d65b), closes #8003
  • fix: optimized processing folder renaming in win (fix #7939) (#8019) (e5fe1c6), closes #7939 #8019
  • fix(css): do not clean id when passing to postcss (fix #7822) (#7827) (72f17f8), closes #7822 #7827
  • fix(css): var in image-set (#7921) (e96b908), closes #7921
  • fix(ssr): allow ssrTransform to parse hashbang (#8005) (6420ba0), closes #8005
  • feat: import ts with .js in vue (#7998) (9974094), closes #7998
  • chore: remove maybeVirtualHtmlSet (#8010) (e85164e), closes #8010

2.9.7 (2022-05-02)

  • chore: update license (d58c030)
  • chore(css): catch postcss config error (fix #2793) (#7934) (7f535ac), closes #2793 #7934
  • chore(deps): update all non-major dependencies (#7949) (b877d30), closes #7949
  • fix: inject esbuild helpers in IIFE and UMD wrappers (#7948) (f7d2d71), closes #7948
  • fix: inline css hash (#7974) (f6ae60d), closes #7974
  • fix: inline style hmr, transform style code inplace (#7869) (a30a548), closes #7869
  • fix: use NODE_ENV in optimizer (#7673) (50672e4), closes #7673
  • fix(css): clean comments before hoist at rules (#7924) (e48827f), closes #7924
  • fix(css): dynamic import css in package fetches removed js (fixes #7955, #6823) (#7969) (025eebf), closes #7955 #6823 #7969
  • fix(css): inline css module when ssr, minify issue (fix #5471) (#7807) (cf8a48a), closes #5471 #7807
  • fix(css): sourcemap crash with postcss (#7982) (7f9f8f1), closes #7982
  • fix(css): support postcss.config.ts (#7935) (274c10e), closes #7935
  • fix(ssr): failed ssrLoadModule call throws same error (#7177) (891e7fc), closes #7177
  • fix(worker): import.meta.* (#7706) (b092697), closes #7706
  • docs: server.origin config trailing slash (fix #6622) (#7865) (5c1ee5a), closes #6622 #7865

2.9.6 (2022-04-26)

  • fix: apply condition skipped for nested plugins (#7741) (1f2ca53), closes #7741
  • fix: clean string regexp (#7871) (ecc78bc), closes #7871
  • fix: escape character in string regexp match (#7834) (1d468c8), closes #7834
  • fix: HMR propagation of HTML changes (fix #7870) (#7895) (1f7855c), closes #7870 #7895
  • fix: modulepreload polyfill only during build (fix #4786) (#7816) (709776f), closes #4786 #7816
  • fix: new SharedWorker syntax (#7800) (474d5c2), closes #7800
  • fix: node v18 support (#7812) (fc89057), closes #7812
  • fix: preview jsdoc params (#7903) (e474381), closes #7903
  • fix: replace import.meta.url correctly (#7792) (12d1194), closes #7792
  • fix: set isSelfAccepting to false for any asset not processed by importAnalysis (#7898) (0d2089c), closes #7898
  • fix: spelling mistakes (#7883) (54728e3), closes #7883
  • fix: ssr.noExternal with boolean values (#7813) (0b2d307), closes #7813
  • fix: style use string instead of js import (#7786) (ba43c29), closes #7786
  • fix: update sourcemap in importAnalysisBuild (#7825) (d7540c8), closes #7825
  • fix(ssr): rewrite dynamic class method name (fix #7751) (#7757) (b89974a), closes #7751 #7757
  • chore: code structure (#7790) (5f7fe00), closes #7790
  • chore: fix worker sourcemap output style (#7805) (17f3be7), closes #7805
  • chore(deps): update all non-major dependencies (#7780) (eba9d05), closes #7780
  • chore(deps): update all non-major dependencies (#7847) (e29d1d9), closes #7847
  • feat: enable optimizeDeps.esbuildOptions.loader (#6840) (af8ca60), closes #6840

2.9.5 (2022-04-14)

2.9.4 (2022-04-13)

  • fix: handle url imports with semicolon (fix #7717) (#7718) (a5c2a78), closes #7717 #7718

2.9.3 (2022-04-13)

2.9.2 (2022-04-13)

  • fix: $ vite preview 404 handling (#7665) (66b6dc5), closes #7665
  • fix: build should also respect esbuild=false config (#7602) (2dc0e80), closes #7602
  • fix: default value of assetsDir option (#7703) (83d32d9), closes #7703
  • fix: detect env hmr (#7595) (212d454), closes #7595
  • fix: EACCES permission denied due to resolve new paths default (#7612) (1dd019f), closes #7612
  • fix: fix HMR propagation when imports not analyzed (#7561) (57e7914), closes #7561
  • fix: nested comments and strings, new regexp utils (#7650) (93900f0), closes #7650
  • fix: revert optimizeDeps false, keep optimizedDeps.disabled (#7715) (ba9a1ff), closes #7715
  • fix: update watch mode (#7132) (9ed1672), closes #7132
  • fix: update ws types (#7605) (b620587), closes #7605
  • fix: use correct proxy config in preview (#7604) (cf59005), closes #7604
  • fix(css): hoist charset (#7678) (29e622c), closes #7678
  • fix(css): include inline css module in bundle (#7591) (45b9273), closes #7591
  • fix(deps): update all non-major dependencies (#7668) (485263c), closes #7668
  • fix(less): handles rewriting relative paths passed Less's data-uri function. (#7400) (08e39b7), closes #7400
  • fix(resolver): skip known ESM entries when resolving a require call (#7582) (5d6ea8e), closes #7582
  • fix(ssr): properly transform export default with expressions (#7705) (d6830e3), closes #7705
  • feat: clean string module lex string template (#7667) (dfce283), closes #7667
  • feat: explicit the word boundary (#6876) (7ddbf96), closes #6876
  • feat: optimizeDeps.disabled (#7646) (48e038c), closes #7646
  • chore: fix term cases (#7553) (c296130), closes #7553
  • chore: revert removed line in #7698 (7e6a2c8), closes #7698
  • chore: type unknown env as any (#7702) (23fdef1), closes #7702
  • chore(deps): update all non-major dependencies (#7603) (fc51a15), closes #7603
  • perf(css): hoist at rules with regex (#7691) (8858180), closes #7691
  • refactor: esbuild handles target and useDefineForClassFields (#7698) (0c928aa), closes #7698
  • docs: update release notes (#7563) (a74bd7b), closes #7563

2.9.1 (2022-03-31)

  • fix: allow port 0 to be provided to server (#7530) (173e4c9), closes #7530
  • fix: brotli let for reassignment (#7544) (d0253d7), closes #7544
  • fix: dynamic import warning with @vite-ignore (#7533) (29c1ec0), closes #7533
  • fix: remove unneeded skipping optimization log (#7531) (41fa2f5), closes #7531
  • docs(changelog): fix raw glob imports syntax (#7540) (87fbe13), closes #7540
  • chore: 2.9 release notes (#7525) (4324f48), closes #7525

2.9.0 (2022-03-30)

Faster Cold Start

Before 2.9, the first time dev was run on a project Vite needed to perform a scan phase to discover dependencies and then pre-bundle them before starting the server. In 2.9 both scanning #7379 and pre-bundling #6758 of dependencies are now non-blocking, so the server starts right away during cold start. We also now allow requests to flow through the pipeline improving initial cold start load speed and increasing the chances of discovering new missing dependencies when re-processing and letting Vite populate the module graph and the browser to process files. In many cases, there is also no need to full-reload the page when new dependencies are discovered.

CSS Sourcemap support during dev (experimental)

Vite now supports CSS sourcemaps #7173. This feature is still experimental, and it is disabled by default to avoid incurring a performance penalty for users that don't need it. To enable it, set css.devSourcemap to true.

Avoid splitting vendor chunks by default

Vite's default chunking strategy was a good fit for most SPAs, but it wasn't ideal in some other use cases. Vite doesn't have enough context to make the best decision here, so in Vite 2.9 the previous chunking strategy is now opt-in #6534 and Vite will no longer split vendor libs in a separate chunk.

Web Workers enhancements

Web Workers now supports source map generation (see #5417). The implementation is also now more robust, fixing several issues encountered in previous versions (#6599).

Raw Glob Imports

Glob imports support for the raw modifier syntax has changed to using { as: 'raw' }, which works in the same way as the ?raw suffix in regular imports:

const examples = import.meta.globEager('./examples/*.html', { as: 'raw' })

The { assert: { type: 'raw' }} syntax introduced in v2.8 has been deprecated. See #7017 for more information.

envDir changes

The envDir now correctly loads .env files in the specified directory only (defaults to root). Previously, it would load files above the directory, which imposed security issues. If you had relied on the previous behaviour, make sure you move your .env files to the correct directory, or configure the envDir option.

New tools for Plugin and Framework Authors

Client Server Communication API

Vite now provides utilities for plugins to help handle the communication with clients connected to Vite's server #7437. Reusing the open WebSocket connection between the server and clients several use cases can be simplified (vite-plugin-inspect, SliDev, and many others). Check out the Client Server Communication docs for more information.

// Send a message from the client to the server
if (import.meta.hot) {
  import.meta.hot.send('my:from-client', { msg: 'Hey!' })
}
// And listen to client messages in a plugin
  configureServer(server) {
    server.ws.on('my:from-client', (data, client) => {
      console.log('Message from client:', data.msg) // Hey!
      // ...
    })
  }

importedCss and importedAssets to RenderedChunk type

Replace the internal chunkToEmittedCssFileMap and chunkToEmittedAssetsMap variables with public properties added by Vite to RenderedChunk objects in the renderChunk phase. These is useful for Vite-based frameworks that generate their own HTML. See #6629.

Optimize Custom Extensions (experimental)

A new optimizeDeps.extensions: string[] option is available to enable pre-bundling of custom extensions. A respective esbuild plugin is required to handle that extension. e.g. ['.svelte', '.svelte.md']. See #6801 for more information.

Bug Fixes

  • fix: build path error on Windows (#7383) (e3c7c7a), closes #7383
  • fix: import url worker two times (#7468) (f05a813), closes #7468
  • fix: import with query with exports/browser field (#7098) (9ce6732), closes #7098
  • fix: make @fs URLs work with special characters (#7510) (2b7dad1), closes #7510
  • fix: tailwind css sourcemap warning (#7480) (90df0bb), closes #7480
  • fix: worker match only run in js (#7500) (9481c7d), closes #7500
  • fix: Correctly process urls when they are rewritten to contain space (#7452) (9ee2cf6), closes #7452
  • fix: custom event payload type (#7498) (28b0660), closes #7498
  • fix: handle relative path glob raw import, fix #7307 (#7371) (7f8dc58), closes #7307 #7371
  • fix: import.meta.url in worker (#7464) (8ac4b12), closes #7464
  • fix: optimizeDeps.entries default ignore paths (#7469) (4c95e99), closes #7469
  • fix: errors in worker handling (#7236) (77dc1a1), closes #7236
  • fix: consider undefined port when checking port (#7318) (c7fc7c3), closes #7318
  • fix: inline style css sourcemap (#7434) (47668b5), closes #7434
  • fix: sourcemap missing source files warning with cached vue (#7442) (a2ce20d), closes #7442
  • fix: update tsconfck to 1.2.1 (#7424) (a90b03b), closes #7424
  • fix: virtual html sourcemap warning (#7440) (476786b), closes #7440
  • fix(less): empty less file error (#7412) (0535c70), closes #7412
  • fix(resolve): skip module field when the importer is a require call (#7438) (fe4c1ed), closes #7438
  • fix: avoid mangling code from incorrect magic-string usage (#7397) (68d76c9), closes #7397
  • fix(config): server restart on config dependencies changed on windows (#7366) (c43467a), closes #7366
  • fix(deps): update all non-major dependencies (#7392) (b63fc3b), closes #7392
  • fix: add version to optimized chunks, fix #7323 (#7350) (1be1db6), closes #7323 #7350
  • fix: browser cache of newly discovered deps (#7378) (392a0de), closes #7378
  • fix: do not warn (about not being able to bundle non module scripts) when src is an external url (#7 (0646fe8), closes #7380
  • fix: overwrite deps info browserHash only on commit (#7359) (1e9615d), closes #7359
  • fix: delayed full page reload (#7347) (fa0820a), closes #7347
  • fix: early discovery of missing deps, fix #7333 (#7346) (7d2f37c), closes #7333 #7346
  • fix: unhandled exception on eager transformRequest (#7345) (c3260a4), closes #7345
  • fix: update to esbuild 0.14.27, fix #6994 (#7320) (65aaeee), closes #6994 #7320
  • fix: ssrExternal should not skip nested dependencies (#7154) (f8f934a), closes #7154
  • fix: dep with dynamic import wrong error log (#7313) (769f535), closes #7313
  • fix: avoid caching transform result of invalidated module (#7254) (2d7ba72), closes #7254
  • fix: dont replace define in json (#7294) (fc5c937), closes #7294
  • fix: main browserHash after stable optimization rerun (#7284) (98eefa8), closes #7284
  • fix: needs es interop check for newly discovered deps (#7243) (ba3047d), closes #7243
  • fix: pending requests after module invalidation (#7283) (a1044d7), closes #7283
  • fix: use browserHash for imports from node_modules (#7278) (161f8ea), closes #7278
  • fix: use hmr port if specified (#7282) (3ee04c0), closes #7282
  • fix: use relative paths in _metadata.json (#7299) (8b945f5), closes #7299
  • fix(asset): allow non-existent url (#7306) (6bc45a2), closes #7306
  • fix(hmr): hmr style tag no support in html (#7262) (fae120a), closes #7262
  • fix: import.meta.url should not throw (#7219) (5de3a98), closes #7219
  • fix: allow localhost as a valid hostname (#7092) (4194cce), closes #7092
  • fix: build optimize deps metada location (#7214) (dc46adf), closes #7214
  • fix: define plugin not ignore file names (#6340) (7215a03), closes #6340
  • fix: deprecate { assert: { type: raw }} in favor of { as: raw } (fix #7017) (#7215) (87ecce5), closes #7017 #7215
  • fix: execute classic worker in dev mode (#7099) (3c0a609), closes #7099
  • fix: handle files with multiple comments (#7202) (3f5b645), closes #7202
  • fix: honor the host param when creating a websocket server (#5617) (882c8a8), closes #5617
  • fix: import css in less/scss (fix 3293) (#7147) (9b51a3a), closes #7147
  • fix: optimizeDeps.include missing in known imports fallback (#7218) (6c08c86), closes #7218
  • fix: prevent loading env outside of root (#6995) (e0a4d81), closes #6995
  • fix: reoptimize deps on esbuild options change (#6855) (4517c2b), closes #6855
  • fix: replacing compression with modern version (#6557) (5648d09), closes #6557
  • fix: restart optimize (#7004) (47fbe29), closes #7004
  • fix: reusing variable names in html module scripts (fix #6851) (#6818) (c46b56d), closes #6851 #6818
  • fix: revert #6340, definePlugin tests, warning box (#7174) (6cb0647), closes #6340 #7174
  • fix: update postcss-load-config to load PostCSS plugins based on their config file path (#6856) (f02f961), closes #6856
  • fix(hmr): client pinging behind a proxy on websocket disconnect (fix #4501) (#5466) (96573db), closes #4501 #5466
  • fix(html): build mode ignore html define transform (#6663) (79dd003), closes #6663
  • fix(json): load json module error (#6352) (c8a7ea8), closes #6352
  • fix(optimizer): add missing keys to hash (#7189) (b0c0efe), closes #7189
  • fix(resolve): try .tsx extension for .js import from typescript module (#7005) (72b8cb6), closes #7005
  • fix(server): base middleware redirect with search and hash (#6574) (a516e85), closes #6574
  • fix(server): ensure consistency for url to file mapping in importAnalysis and static middleware (#65 (b214115), closes #6518
  • fix(ssr): bypass missing resolve error in SSR (#7164) (a4927c5), closes #7164

Features

  • feat(worker): Add sourcemap support for worker bundles (#5417) (465b6b9), closes #5417
  • feat(type): support typing for custom events (#7476) (50a8765), closes #7476
  • refactor(types): share hot context type (#7475) (64ddff0), closes #7475
  • feat: support importing css with ?raw (#5796) (fedb106), closes #5796
  • feat(css): css.devSourcemap option (#7471) (57f14cb), closes #7471
  • feat(dev): expose APIs for client-server communication (#7437) (e29ea8e), closes #7437
  • feat: hide optimized deps found during scan phase logs (#7419) (f4934e8), closes #7419
  • feat: non-blocking scanning of dependencies (#7379) (676f545), closes #7379
  • feat: css sourcemap support during dev (#7173) (38a655f), closes #7173
  • feat: expose ssrRewriteStacktrace (#7091) (d4ae45d), closes #7091
  • feat: add importedCss and importedAssets to RenderedChunk type (#6629) (8d0fc90), closes #6629
  • feat: non-blocking pre bundling of dependencies (#6758) (24bb3e4), closes #6758
  • feat: optimize custom extensions (#6801) (c11af23), closes #6801
  • feat: show all prebundle deps when debug (#6726) (e626055), closes #6726
  • feat(glob): import.meta.glob support alias path (#6526) (86882ad), closes #6526
  • feat(perf): tsconfck perf improvement (#7055) (993ea39), closes #7055
  • feat(worker): bundle worker emit asset file (#6599) (0ade335), closes #6599
  • refactor: avoid splitting vendor chunk by default (#6534) (849e845), closes #6534

Beta Changelogs

2.9.0-beta.11 (2022-03-29)

See 2.9.0-beta.11 changelog

2.9.0-beta.10 (2022-03-28)

See 2.9.0-beta.10 changelog

2.9.0-beta.9 (2022-03-26)

See 2.9.0-beta.9 changelog

2.9.0-beta.8 (2022-03-24)

See 2.9.0-beta.8 changelog

2.9.0-beta.7 (2022-03-23)

See 2.9.0-beta.7 changelog

2.9.0-beta.6 (2022-03-22)

See 2.9.0-beta.6 changelog

2.9.0-beta.5 (2022-03-22)

See 2.9.0-beta.5 changelog

2.9.0-beta.4 (2022-03-19)

See 2.9.0-beta.4 changelog

2.9.0-beta.3 (2022-03-16)

See 2.9.0-beta.3 changelog

2.9.0-beta.2 (2022-03-14)

See 2.9.0-beta.2 changelog

2.9.0-beta.1 (2022-03-14)

See 2.9.0-beta.1 changelog

2.9.0-beta.0 (2022-03-09)

See 2.9.0-beta.0 changelog

2.8.6 (2022-03-01)

Bug Fixes

2.8.5 (2022-02-28)

Bug Fixes

Features

2.8.4 (2022-02-18)

Bug Fixes

2.8.3 (2022-02-15)

Bug Fixes

2.8.2 (2022-02-14)

Features

Performance Improvements

2.8.1 (2022-02-11)

Bug Fixes

2.8.0 (2022-02-09)

Reduced Footprint

Vite 2.8.0 is almost 1/4 of the 2.7.0 publish size, and the install size has been reduced by 35%. See this thread about each change that reduced Vite's footprint.

Version Publish Size Install Size
2.7.0 12.7MB 25.2MB
2.8.0 4.6MB 17.4MB

Default preview port

New default port for vite preview is 4173 (avoid conflicts in macOS that took over the 5000 port)

Workers using standard syntax

Workers are detected and bundled when using new URL('path', import.meta.url), replacing the need for the ?worker suffix and aligning Vite with standard patterns. See #6356. Instead of

import MyWorker from './worker.js?worker'
const worker = new MyWorker()

it is now recommended to use

const worker = new Worker(
  new URL('./worker.js', import.meta.url), { type: 'module' }
)

Configuring Workers Bundling

New worker config field adding support for Worker format, plugins and, rollupOptions. See #6351

  • worker.format: 'es' | 'iife'
    Output format for worker bundle (default: iife).
  • worker.plugins: (Plugin | Plugin[])[]
    Vite plugins that apply to worker bundle.
  • worker.rollupOptions: RollupOptions
    Rollup options to build worker bundle.

The worker plugins pipeline isn't shared with the main Vite pipeline, there may be plugins that shouldn't be applied to Workers. If a plugin must be applied to both the main build and the worker build, you need to add a plugin in the main plugins array and another one in the worker.plugins config.

import PluginX from 'vite-plugin-x'
export default {
  plugins: [ PluginX() ]
  worker: {
    format: 'es',
    plugins: [ PluginX() ]
  }
}

Raw Glob Imports

Glob imports now support the raw modifier (that works in the same way as the ?raw suffix in regular imports). Vite is going to gradually migrate to the new standard assert syntax instead of using custom URL suffixes where possible.

const examples = import.meta.globEager('./examples/*.html', { assert: { type: 'raw' }})
  • New server.headers config option allowing configuration of response headers in dev mode.
export default {
 server: {
    port: '8080',
    headers: {
      'Cache-Control': 'no-store'
    }
  },
}

Bug Fixes

Features

Beta Changelogs

2.8.0-beta.7 (2022-02-08)

See 2.8.0-beta.7 changelog

2.8.0-beta.6 (2022-02-07)

See 2.8.0-beta.6 changelog

2.8.0-beta.5 (2022-02-02)

See 2.8.0-beta.5 changelog

2.8.0-beta.4 (2022-01-31)

See 2.8.0-beta.4 changelog

2.8.0-beta.3 (2022-01-18)

See 2.8.0-beta.3 changelog

2.8.0-beta.2 (2022-01-13)

2.8.0-beta.2 changelog

2.8.0-beta.1 (2022-01-06)

See 2.8.0-beta.1 changelog

2.8.0-beta.0 (2022-01-05)

See 2.8.0-beta.0 changelog

2.7.9 (2021-12-28)

2.7.8 (2021-12-28)

Bug Fixes

  • html: show error overlay when parsing invalid file (#6184) (1f945f6)
  • seperate source and dep for dymamic import after build (#6251) (49da986)
  • ssr: capture scope declaration correctly (#6281) (60ce7f9)
  • upgrade to launch-editor with picocolors (#6209) (394539c)

2.7.7 (2021-12-26)

Bug Fixes

2.7.6 (2021-12-22)

Bug Fixes

  • remove virtual module prefix while generating manifest (#6225) (d51259b)

2.7.5 (2021-12-21)

Bug Fixes

2.7.4 (2021-12-20)

Bug Fixes

  • duplicate variable declaration caused by css modules (#5873) (8e16a78)
  • improve error message for HTML compilation error (fix #5769) (#5777) (79d1397)
  • ssr: ssrTransform function argument destructure (#6171) (2762a0e)

2.7.3 (2021-12-16)

Bug Fixes

  • do not overwrite rollupOptions.input in dev (#6025) (6cdf13a)
  • Improve post-build asset update check (#6113) (611fa03)
  • improve warning message for malformed packages (#6086) (717cb08)
  • pending reload never timeout (#6120) (e002f4f)
  • respect new port when change the config file (#6075) (3ceffcc)
  • ssr: robust regexp to check cjs content (#6053) (0373441)
  • terminate WebSocket connections before closing WebSocket server (#6115) (b9871bb)

2.7.2 (2021-12-13)

Bug Fixes

2.7.1 (2021-12-07)

Bug Fixes

  • ssr: ssrTransform handling for empty ArrayPattern (#5988) (79aa687)

2.7.0 (2021-12-07)

  • 🎉 Revamped SSR dependency handling
  • 🧩 API consolidation
  • 🛑 server.fs.strict by default

BREAKING CHANGES

  • server.fs.strict is true by default (#5341) See server filesystem restriction docs for more details.
  • Plugin hooks ssr param to object in resolveId, load, and transform (#5253) Previous to this release, the ssr param was passed as a boolean in the last parameter of each hook. The new interface for these hooks is now:
    export interface Plugin extends RollupPlugin {
      // ... other hooks
      resolveId?(this: PluginContext, source: string, importer: string | undefined, options: {
          custom?: CustomPluginOptions;
          ssr?: boolean;
      }): Promise<ResolveIdResult> | ResolveIdResult;
      load?(this: PluginContext, id: string, options?: {
          ssr?: boolean;
      }): Promise<LoadResult> | LoadResult;
      transform?(this: TransformPluginContext, code: string, id: string, options?: {
          ssr?: boolean;
      }): Promise<TransformResult> | TransformResult;
    }
    In your plugins, you can check if the last param is a boolean or an object to be backward compatible with 2.6 and give some time to users to migrate to Vite 2.7.
  • server.pluginContainer options object for resolveId, load, and transform (#5294)
  • Normalize scripts and commands naming (#5207) Adds a new vite dev command alias for vite serve, preparing for the new release of create-vite where package scripts are renamed to dev, build, and preview.
  • Align experimental preview api (#5407) This API was first introduced in 2.6 and it is still in flux.
  • resolve rollupOptions.input paths (#5601)

Features

2.7.0-beta.11 (2021-12-06)

Bug Fixes

  • ssr: allow primitive default exports and forwarded exports (#5973) (a47b663)

2.7.0-beta.10 (2021-12-02)

Bug Fixes

2.7.0-beta.9 (2021-11-27)

Bug Fixes

Features

2.7.0-beta.8 (2021-11-19)

Bug Fixes

  • hmr: prevent SSR from setting isSelfAccepting to false (#5377) (37e5617)
  • move package.json cache into ResolvedConfig (#5388) (650b56e)
  • scoped variable with array destructuring & nested arguments (#5730) (b86a2f3)
  • transformCjsImport: make dev and build get the same result (#5745) (9d3e4e6)

Features

  • dev: expose restart function on ViteDevServer (#5723) (1425a16)

2.7.0-beta.7 (2021-11-17)

Bug Fixes

2.7.0-beta.6 (2021-11-16)

Bug Fixes

2.7.0-beta.5 (2021-11-13)

Bug Fixes

  • correctly resolve virtual modules during import scan (#5659) (40d503c)
  • resolve: check nested directories for package.json (#5665) (022db52)
  • ssr: prefer CJS but still allow ESM entries (#5662) (72d8925)
  • tolerate undefined parent in hookNodeResolve callback (#5664) (d788682)

2.7.0-beta.4 (2021-11-12)

Bug Fixes

Features

2.7.0-beta.3 (2021-11-08)

2.7.0-beta.2 (2021-11-08)

Bug Fixes

  • commonjs: expose ignoreTryCatch config option (#5555) (d383c2a)
  • esbuild: respect esbuild config on build (#5538) (ff05fe9)
  • hmr: revert early break from handleHotUpdate loop (#5536) (4abade6)
  • replace server.origin in css plugin (fix #5408) (#5571) (bd8b66d)
  • server: use options argument in caching of transformRequest calls (#5391) (27b7f90)
  • Windows path error on script proxying (#5556) (f8dc1ee)

Features

2.7.0-beta.1 (2021-11-01)

Bug Fixes

2.7.0-beta.0 (2021-10-28)

Bug Fixes

Features

2.6.13 (2021-10-27)

Bug Fixes

2.6.12 (2021-10-26)

Bug Fixes

2.6.11 (2021-10-25)

Bug Fixes

Performance Improvements

2.6.10 (2021-10-18)

Bug Fixes

2.6.9 (2021-10-18)

2.6.8 (2021-10-18)

Bug Fixes

Features

2.6.7 (2021-10-11)

2.6.6 (2021-10-11)

Bug Fixes

  • avoid unnecessary pre-bundling warning (b586098)
  • server: skipped for ended response (#5230) (7255fd5)

Features

2.6.5 (2021-10-07)

Features

  • internal: expose printHttpServerUrls (f94a720)
  • server: expose server.printUrls() (96a9ee4)

2.6.4 (2021-10-07)

Bug Fixes

  • better error message for parse failures (#5192) (8fe8df3)
  • use Function instead of eval to dynamically import config files (#5213) (10694dd)

2.6.3 (2021-10-05)

Bug Fixes

2.6.2 (2021-09-30)

Bug Fixes

2.6.1 (2021-09-29)

Bug Fixes

2.6.0 (2021-09-29)

2.6.0-beta.4 (2021-09-28)

Bug Fixes

  • don't overwrite default options unless given new value (#5111) (4d72b40)
  • use global location for import.meta.url rewrite (fix #5087) (#5113) (0b54853)

2.6.0-beta.3 (2021-09-27)

Bug Fixes

Features

2.6.0-beta.2 (2021-09-23)

Bug Fixes

2.6.0-beta.1 (2021-09-23)

Bug Fixes

  • bump js parser ecmaVersion option to 'latest', fix #5013 (#5021) (3541ebc)
  • dedupe import analysis public name (#5032) (545b1f1)
  • exclude ?commonjs-external when building in JSON plugin (#4867) (fe25567)
  • exclude missing dependencies from optimization during SSR (#5017) (2204afa)
  • move peerDeps from #2042 to the right package.json (3161d75)
  • sourcemaps windows drive letter inconsistency, fix 4964 (#4985) (723cd63)
  • ssr: handle default arguments properly in ssrTransform (#5040) (6a60080)
  • use lax range for peer deps (35bd963)

Features

2.6.0-beta.0 (2021-09-20)

Bug Fixes

Features

Performance Improvements

  • report compressed size using gzip instead of brotli due to drastic (deb84c0)

2.5.7 (2021-09-13)

Bug Fixes

  • compute getPkgName only when used (#4729) (ce29273)
  • css: return sourcemap in vite:css transform (#4880) (015290a)
  • esbuildDepPlugin: externalize built-in module during SSR (#4904) (5cc4587)
  • the base is duplicated in importAnalysisBuild.ts (#4740) (7e929ae)

Features

2.5.6 (2021-09-08)

Bug Fixes

  • importAnalysis: properly inherit dependency version query for self imports (c7c39b1)
  • use debugger for package resolution warnings (#4873) (38de2c9)

2.5.5 (2021-09-08)

Bug Fixes

  • hmr: should break on first matched plugin that performs custom hmr handling (b3b8c61)

2.5.4 (2021-09-07)

Bug Fixes

  • check for Blob before creating worker URL, close #4462 (#4674) (311026f)
  • css: loadPreprocessor tolerate require.resolve.paths not exists (#4853) (c588b8f)
  • handle error in numberToPos and formatError (#4782) (c87763c)
  • overlay: handle missing customElements (#4856) (e5b472d)
  • sometimes THIS_IS_UNDEFINED warnings were still shown (#4844) (8d956f6)

2.5.3 (2021-09-01)

Bug Fixes

  • apply SSR externalization heuristic to devDependencies (#4699) (0f1d6be)
  • resolve: normalize optimized resolved path (#4813) (fa6475f)

2.5.2 (2021-08-31)

Bug Fixes

Features

2.5.1 (2021-08-24)

Bug Fixes

  • DEFINES is not defined is env (#4694) (ff50c22)
  • Matcher for chokidar WatchOptions#ignored (#4616) (89e7a41)
  • enable failing dependencies to be optimised by pre-processing them with esbuild (#4275) (ea98a1a)
  • css: minify css will transform rgba to #rrggbbaa (#4658) (632a50a)
  • CSS dependencies are tracked incorrectly when base is set (#4592) (633c03a)
  • css: dynamic import css abnormal after build (#3333) (b572f57)
  • scan: do not match 'export default' in comments (#4602) (8b85f5f)
  • vite: unexptected overwriting for default export fix(#4553) (#4596) (c7929ad)
  • surface exception when failing to resolve package entry (#4426) (f75e508)

Features

2.5.0 (2021-08-16)

2.5.0-beta.3 (2021-08-14)

Bug Fixes

  • add ?inline css query typings (#4570) (c8a17a2)
  • skip optimizer run on non-JS script tags (#4565) (270bd3a)
  • support dangling comma and throw on circular dependency in tsconfig (#4590) (f318416)

2.5.0-beta.2 (2021-08-09)

Bug Fixes

  • client: vite-error-overlay customElement is registered twice (#4475) (28a9612)
  • add missing assets to packages/vite/client.d.ts (#4516) (420d82d)
  • avoid crash when a file imported in SCSS does not exist (#4505) (a03e944)

Features

2.5.0-beta.1 (2021-08-04)

Bug Fixes

  • change the preview default mode from development to production (#4483) (77933ba)
  • close vite dev server before creating new one (#4374) (9e4572e)
  • register files added by addWatchFile() as current module's dependency (db4ba56), closes #3216

Features

2.5.0-beta.0 (2021-08-03)

Bug Fixes

  • mixed match result of importMetaUrl (#4482) (86f673a)
  • build: respect rollup output.assetFileNames, fix #2944 (#4352) (cbd0458)
  • deps: update all non-major dependencies (#4468) (cd54a22)
  • html: cover more cases in bodyPrependInjectRE (#4474) (40c51e1)
  • server: keep port when modifying the config file (#4460) (056b17e)
  • config port timing, fix #4094 (#4104) (6b98fdd)
  • overwrite configEnv.mode if the user explicitly set mode option (fix #4441) (#4437) (7d340a6)
  • update dependency @rollup/plugin-commonjs to v20, fix #2623 (#4469) (f9e5d63)
  • scan: improve import regex and allow multiline comments (#4088) (76dbef6)
  • @vite/client http request is 404 not found (#4187) (21ecdac)
  • import sass file even if not listed in package.json (#3627) (a5b2b4f)
  • the return value of resolve by adding a namespace when processing a '@' in filter (#3534) (d4e979f)
  • build: fix define plugin spread operations (#4397) (bd7c148)
  • preserve base in HMR for CSS referenced in link tags (#4407) (a06b26b)

Features

2.4.4 (2021-07-27)

Bug Fixes

  • deps: update all non-major dependencies (#4387) (2f900ba)
  • --https get ignored in preview (#4318) (a870584)
  • don't interact with res if refresh has happened (#4370) (c90b7d9)
  • fix pre-bundling executes multiple times (#3640) (41a00df)
  • handle imports from dot directories (#3739) (f4f0100)
  • ignore ENOENT in injectSourcesContent (#2904) (0693d03)
  • provide build load fallback for arbitrary request with queries (f097aa1)
  • css: cachedPostcssConfig reused for multiple builds (#3906) (3a97644)

Features

  • support ?inline css query to avoid css insertion (e1de8a8)

2.4.3 (2021-07-20)

Bug Fixes

Features

2.4.2 (2021-07-12)

Bug Fixes

Features

2.4.1 (2021-07-06)

Bug Fixes

2.4.0 (2021-07-05)

2.4.0-beta.3 (2021-07-02)

Bug Fixes

  • ssr: Transform named default exports without altering scope (#4053) (5211aaf)
  • add type: "module" hint to cache directory (#4063) (58a29b2)
  • allow preprocessor to be installed outside of the root directory (#3988) (a0a80f8)
  • Avoid importing in source that __vitePreload has declared (close #4016) (#4041) (bd34203)
  • ensure that esbuild uses the same working directory as Vite (#4001) (19abafe)
  • fix esbuild break when importRe matches multiline import (#4054) (eb2e41b)
  • skip redirect and error fallback on middleware mode (#4057) (d156a9f)
  • the current main branch code build the vite project error (#4059) (4adc970)
  • use .mjs extension for injected client modules (#4061) (cca92c4)
  • use path type import, fix #4028 (#4031) (e092e89)

2.4.0-beta.2 (2021-06-29)

Bug Fixes

2.4.0-beta.1 (2021-06-29)

Bug Fixes

  • hmr: entry mod's importers contains css mod invalidate hmr (#3929) (d97b33a)
  • types: correct import of types (#4003) (4954636)

Features

  • allow passing options to rollupjs dynamic import vars plugin (#3047) (5507b4c)

2.4.0-beta.0 (2021-06-27)

BREAKING CHANGES

  • server: server.fsServe renamed to server.fs (#3965)
  • server: server.fs.root deprecated in favor of server.fs.allow (#3968)

Security

We have improved the file serving boundaries detection with (#3784). While it's still experimental and disabled by default, you can opt-in it by

// vite.config.js
export default {
  server: {
    fs: {
      strict: true
    }
  }
}

It should smartly serve the files related to your project (directly imported, linked deps, etc.) while denying the rest. If you find any false-negative, please open an issue with reproduction to report.

Bug Fixes

Features

  • add client events to import.meta.hot.on (#3638) (de1ddd4)
  • fs-serve import graph awareness (#3784) (c45a02f)
  • generate inline sourcemaps for bundled vite.config.js files (#3949) (cff2fcd)
  • support for regex for ssr.noExternal (#3819) (330c94c)
  • support new URL(url, import.meta.url) usage (4cbb40d)

2.3.8 (2021-06-19)

Bug Fixes

  • css: filter out function name suffixes with url (#3752) (9aa255a)
  • deps: update all non-major dependencies (#3791) (74d409e)
  • hmr: always invalidate all affected modules (e048114)
  • hmr: avoid css propagation infinite loop (7362e6e)
  • hmr: avoid duplicated modules for css dependency (385ced9)
  • hmr/css: check CSS importers for hmr boundaries - fix Tailwind 2.2 compat (6eaec3a)
  • hmr/css: fix infinite recursion on hmr (#3865) (0d5726f)
  • ?import with trailing = added by some servers (#3805) (460d1cd)
  • don't replace process.env if process not global variable (#3703) (5aeadb7)
  • upgrade esbuild for esm compatibility (#3718) (dbb5eab), closes #3399 #3413

Features

  • allow 'hidden' sourcemap to remove //# sourceMappingURL from generated maps (#3684) (19e479b)

2.3.7 (2021-06-08)

Bug Fixes

  • Include src files in vite npm bundle (for sourcemaps) (#3656) (294d8b4)
  • show error message above the stack when HMR overlay is disabled (#3677) (6b4c355)
  • tolerant fs error in formatError (#3665) (5146cc5)
  • update sirv to decode url in preview (#3680) (0430127)

Features

  • css: support postcss dir-dependency message type (#3707) (665d438)

2.3.6 (2021-06-02)

Bug Fixes

2.3.5 (2021-06-01)

Bug Fixes

Features

2.3.4 (2021-05-25)

Bug Fixes

Features

  • support serving index.html in middleware mode (#2871) (b1598ce)

2.3.3 (2021-05-17)

Bug Fixes

2.3.2 (2021-05-12)

Bug Fixes

2.3.1 (2021-05-12)

Notable Changes

We introduced a security fix in v2.3.0 to restrict file access outside of the workspace root. We received reports of issues with symlinks and monorepo setups, so we are marking this feature as experimental and disabling it by default to avoid disruption in the ecosystem.

A new experimental option server.fsServe.strict was added defaulting to false. This disables the restrictions by default. The fsServe restrictions are going to be enabled by default in a future version, once the issues are been resolved and the logic becomes more robust. You can opt-in to this security change using (experimental)

// vite.config.js
export default {
  server: {
    fsServe: {
      strict: true
    }
  }
}

Bug Fixes

  • bump @rollup/plugin-commonjs to v19, fix #3312 (#3353) (c6ef6d0)
  • disable fsServe restrictions by default (#3377) (5433a65)
  • normalize url in ensureServingAccess (#3350) (deb465b)
  • use the closest package.json as root when workspace not found fo… (#3374) (42b35ac)

2.3.0 (2021-05-11)

BREAKING CHANGES

  • Browser default targets changed (PR #2976)
    • Default browser support range has changed. The minimum requirement is now native dynamic import support. Most notably, this means support for legacy Microsoft Edge (16-18) has been dropped.
    • vite/dynamic-import-polyfill removed and no longer required in custom entries

Why are there breaking changes in a minor?

  • Limited impact: The affected target browsers are ones that natively support ES6 modules (92.83% of global usage) but do not support native dynamic imports (92.34% of global usage). So this is a small range affecting only 0.49% of global usage.

    This number should continue to decrease in the future as most modern browsers are evergreen. You are also not affected if you are already targeting legacy browsers using @vitejs/plugin-legacy.

  • Easy migration: if you do intend to support browsers that fall into this category, you can use dynamic-import-polyfill.

    To make the polyfill work, you will also need to use a plugin with renderDynamicImport to change the import calls to __import__. You can follow the installation guide in this example.

  • Required for bug fixes: This change is required for upgrading esbuild from v0.9 to v0.11, which includes a lot of bug fixes and improvements. And it also allows us to remove the complexity of the dynamic import polyfill.

Security Fixes

  • Dev server only listens to localhost by default now (PR #2977)
    • Pass --host 0.0.0.0 to change back to the previous behavior.
  • Dev server only serves files under workspace root by defualt (PR #2850, #3321)
    • Accessing files outside of workspace root will result in a 403 response.
    • Vite will try to search up for workspace root defined in package.json or pnpm-workspace.yaml
    • To set the workspace root explicitly, see configurations

Bug Fixes

Features

  • add optimizeDeps.esbuildOptions (#2991) (77a882a)
  • set publicDir to false to disable copied static assets to build dist dir (#3152) (f4ab90a)
  • webworker ssr target (#3151) (1c59ef1)

2.2.4 (2021-05-03)

Bug Fixes

Features

  • Allow overwrite TerserOptions.safari10 from UserConfig (#3113) (7cd8d78)

2.2.3 (2021-04-25)

Bug Fixes

2.2.2 (2021-04-24)

Bug Fixes

Features

2.2.1 (2021-04-19)

Bug Fixes

  • optimizer: depScan resolve with flatIdDeps (#3053) (cb441ef)

2.2.0 (2021-04-19)

Bug Fixes

Features

2.1.5 (2021-03-31)

Bug Fixes

  • do not inject ?import query to external urls (be3a4f5)
  • replace __dirname and __filename in config file, fix #2728 (#2780) (eb57ac6)

2.1.4 (2021-03-30)

Bug Fixes

Features

  • dev: support keepNames option for optimizeDependencies config (#2742) (130bf5a)

2.1.3 (2021-03-25)

Bug Fixes

Features

2.1.2 (2021-03-17)

Bug Fixes

  • update esbuild target to allow destructuring (#2566) (da49782)
  • manifest: do not fail when using rollupOtions.external (#2532) (e44cc11)

2.1.1 (2021-03-16)

Bug Fixes

  • decode path before reading sourcemap source content (73b80d5), closes #2524
  • scan: handle await replacement edge case (cbfc3e9), closes #2528
  • enable latest syntax when parsing for ssr (407ce3b), closes #2526

2.1.0 (2021-03-15)

Bug Fixes

  • json: support importing json with ?url and ?raw queries (fd0a0d9), closes #2455
  • ssr: fix mistakenly overwriting destructure variables as import bindings (#2417) (24c866f), closes #2409
  • correctly handle explicit ts config file (#2515) (e8f3c78)
  • hmr: never invalidate an accepting importer (#2457) (63bd250)
  • ssr: handle empty sourcemaps (fix #2391) (#2441) (103dec9)
  • fix early logger definiton in resolveConfig (#2425) (96ea9f4)
  • Improve how @fs urls are printed (#2362) (5d4e82d)
  • Improve injectQuery path handling (#2435) (a5412f8), closes #2422
  • keep process running when fail to load config in restarting server (#2510) (b18af15), closes #2496
  • make import resolution failures easier to track down (#2450) (f6ac860)
  • respect cors and proxy options in preview command (f7d85ae), closes #2279
  • url linked to wmr rollup-plugin-container.js found 404 (#2368) (209232c)
  • build: respect rollupOtions.external at generate manifest(#2353) (b05a567)

Features

  • allow custom websocket server (#2338) (9243cc9)
  • bundle vite config file with esbuild instead of rollup (#2517) (e034ee2)
  • dev: support keepNames for dependencies (#2376) (b5cd8c8)

2.0.5 (2021-03-02)

Bug Fixes

2.0.4 (2021-02-26)

Bug Fixes

  • build: css tags injection priority (#2272) (55ad23e)
  • css: ignore css commonjs-proxy modules (#2160) (de33d32)
  • optimizer: detect re-exports in dep entries (a3abf99), closes #2219
  • sourcemap: avoid cjs import interop line offset messing up sourcemap (4ce972d), closes #2280
  • sourcemap: inject sourcesContent for .map requests (#2283) (8d50b18)
  • ssr: allow ssr module export overwrites (#2228) (6fae0b7)
  • add source and sourcesContent to transformed SSR modules (#2285) (72be67b), closes #2284
  • optimizer: fix deps aliased to cdns that are imported by optimized deps (06d3244), closes #2268
  • ssr: handle imported binding being used as super class (167a9c3), closes #2221
  • ssr: handle ssrLoadModule failures in post pending (#2253) (ea323cc), closes #2252
  • ssr: ssr transform method definition (#2223) (8e0c0fa)
  • decode url before serving static files (#2201) (1342108), closes #2195
  • determine anonymous function wrapper offset at runtime (#2266) (a2ee885), closes #2265

2.0.3 (2021-02-24)

Bug Fixes

  • resolve: compat for babel 7.13 helper resolution (39820b9)
  • ssr: fix ssr external check for mjs entries (5095e04), closes #2161
  • do not prepend base to double slash urls during dev (#2143) (7a1b5c6)
  • handle escape sequences in import specifiers (#2162) (bbda31e), closes #2083
  • should transform the img tag's srcset arrtibute and css' image-set property (#2188) (0f17a74), closes #2177
  • treat the watcher path as literal name (#2211) (58bed16), closes #2179
  • use proper esbuild loader for .cjs and .mjs files (#2215) (a0d922e)
  • optimizer: let esbuild resolve transitive deps (0138ef3), closes #2199
  • scan: avoid replacing await in import specifiers (94e5b9a), closes #2210

2.0.2 (2021-02-22)

Bug Fixes

  • build: do not handle asset url when its url is "#" (#2097) (0092a35), closes #2096
  • cli: fix short flags being ignored (#2131) (cbb3eff)
  • optimizer: do not optimize deps w/ jsx entrypoints (1857652), closes #2107
  • optimizer: externalize jsx/tsx files in dependencies (37a103f)
  • optimizer: fix .styl externalization (87cfd9e), closes #2168
  • resolve: fix browser mapping fallback (de58967), closes #2115
  • scan: set namespace when resolving to html (#2174) (3be4fac), closes #2163
  • ssr: avoid duplicate ssr module instantiation on shared imports (a763ffd), closes #2060
  • ssr: fix ssr export * from (8ed67cf), closes #2158
  • typo (#2149) (2b19e3c)
  • ssr: reject ssrLoadModule promises if evaluation fails (#2079) (e303c4e), closes #2078
  • stricter html fallback check in transformRequest (d0eac2f), closes #2051

2.0.1 (2021-02-17)

Bug Fixes

  • allow custom process.env.VAR defines (#2055) (7def49a)
  • do not error on failed load for SPA html requests (44a30d5), closes #2051
  • more inclusive config syntax error hanlding for Node 12.x (27785f7), closes #2050

2.0.0 (2021-02-16)

Bug Fixes

  • css/assets: respect alias in css url() paths (ad50060), closes #2043
  • resolve: handle hash fragment in fs resolve (34064c8)
  • scan: fix top level await handling in script setup (24ed098), closes #2044
  • scan: ignore virtual entries during scan (6dc2d56), closes #2047
  • always transform applicable requests (#2041) (4fd61ab)

2.0.0-beta.70 (2021-02-15)

Bug Fixes

  • respect host option when listening (f05ae32), closes #2032
  • css: resolve pre-processors from project root (ddfcbce), closes #2030
  • reject preload promise if link fails to load (#2027) (f74d65d), closes #2009
  • ssr: ignore base when normalizing urls for ssr (26d409b), closes #1995

Code Refactoring

  • make define option perform direct replacement instead (059070e)

Features

  • css: allow async additionalData function for css pre-processors (20f609d), closes #2002
  • allow getJSON option on css.modules (#2025) (e324e36)

BREAKING CHANGES

  • define option no longer calls JSON.stringify on string values. This means string define values will be now treated as raw expressions. To define a string constant, explicit quotes are now required.

2.0.0-beta.69 (2021-02-11)

Bug Fixes

  • fix out of root static file serving on windows (4d34a73), closes #1982
  • Remove negative count in stdout with 0 rows (#1983) (09b13ed), closes #1981
  • ssr: handle virtual modules during ssr (108be94), closes #1980
  • prevent crash on malformed URI (#1977) (f1b0bc9)
  • user define on import.meta.env should apply during dev (603d57e)

Features

  • pass config env to plugin config hook (19f3503)

2.0.0-beta.68 (2021-02-11)

Bug Fixes

  • css/assets: properly replace multiple css asset urls on the same line (1d805a6), closes #1975
  • scan: handle lang=jsx in sfcs (2f9549c), closes #1972
  • fix path normalization for windows paths w/ non ascii chars (03b323d), closes #1384

Features

  • support --open for vite preview command (#1968) (446b815)
  • resolve: expose full resolve options via config (0318c64), closes #1951

Performance Improvements

  • ignore node_modules when globbing import.meta.glob (8b3d0ea), closes #1974

2.0.0-beta.67 (2021-02-09)

Bug Fixes

  • html: avoid duplicate preload link injection (6e71596), closes #1957
  • ssr: fix ssr node require for virtual modules (fa2d7d6)
  • do not open browser when restarting server (#1952) (9af1517)

2.0.0-beta.66 (2021-02-08)

Bug Fixes

  • import-analysis: fix literal dynamic id false positive (6a6508e), closes #1902
  • resolve: avoid race condition in resolve skip check (85f1e7b), closes #1937
  • resolve: pass down resolve skip via context (9066f27), closes #1937
  • scan: only scan supported entry file types (a93e61d)
  • use dedicated endpoint for hmr reconnect ping (b433607), closes #1904
  • ssr: ssr external should take scannd imports into account (92934d4), closes #1916
  • brotli skipped is printed when build.brotliSize is false (#1912) (db3c324)

2.0.0-beta.65 (2021-02-05)

Bug Fixes

  • build: ignore html asset urls that do not exist on disk (02653f0), closes #1885
  • better dependency non-js type file handling (1fdc710)
  • dev: check wasClean in onclose event (#1872) (5d3107a)
  • resolve: prioritize file over dir with same name for resolve (