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 of127.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
, orcjs
) 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
toExportData.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
anddev
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 of127.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)
3.0.0-alpha.14 (2022-06-20)
3.0.0-alpha.13 (2022-06-19)
3.0.0-alpha.12 (2022-06-16)
3.0.0-alpha.11 (2022-06-14)
3.0.0-alpha.10 (2022-06-10)
3.0.0-alpha.9 (2022-06-01)
3.0.0-alpha.8 (2022-05-31)
3.0.0-alpha.7 (2022-05-27)
3.0.0-alpha.6 (2022-05-27)
3.0.0-alpha.5 (2022-05-26)
3.0.0-alpha.4 (2022-05-25)
3.0.0-alpha.3 (2022-05-25)
3.0.0-alpha.2 (2022-05-23)
3.0.0-alpha.1 (2022-05-18)
3.0.0-alpha.0 (2022-05-13)
2.9.12 (2022-06-10)
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
tofalse
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)
- fix: revert #7582, fix #7721 and #7736 (#7737) (fa86d69), closes #7721 #7736 #7737
- chore: format css minify esbuild error (#7731) (c445075), closes #7731
2.9.4 (2022-04-13)
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
anduseDefineForClassFields
(#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 arequire
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
andimportedAssets
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)
2.9.0-beta.10 (2022-03-28)
2.9.0-beta.9 (2022-03-26)
2.9.0-beta.8 (2022-03-24)
2.9.0-beta.7 (2022-03-23)
2.9.0-beta.6 (2022-03-22)
2.9.0-beta.5 (2022-03-22)
2.9.0-beta.4 (2022-03-19)
2.9.0-beta.3 (2022-03-16)
2.9.0-beta.2 (2022-03-14)
2.9.0-beta.1 (2022-03-14)
2.9.0-beta.0 (2022-03-09)
2.8.6 (2022-03-01)
Bug Fixes
- revert #7052, hmr style tag no support in html (#7136) (5c116ec)
- throw Error when can't preload CSS (#7108) (d9f8edb)
2.8.5 (2022-02-28)
Bug Fixes
- ?html-proxy with trailing = added by some servers (#7093) (5818ac9)
- allow optional trailing comma in asset
import.meta.url
(#6983) (2debb9f) - cannot reassign process.env.NODE_ENV in ssr (#6989) (983feb2)
- config: Warn about terserOptions in more cases (#7101) (79428ad)
- don't override user config (#7034) (8fd8f6e)
- fileToBuiltUrl got undefined when file type is
.ico
(#7106) (7a1a552) - glob: css imports injecting a ?used query to export the css string (#6949) (0b3f4ef)
- hmr: hmr style tag no support in html (#7052) (a9dfce3)
- image -> image/x-icon (#7120) (065ceca)
- import with query with exports field (#7073) (88ded7f)
- prebundle dep with colon (#7006) (2136f2b)
- recycle serve to avoid preventing Node self-exit (#6895) (d6b2c53)
- resolve @import of the proxied <style> (#7031) (c7aad02)
- ssrTransform: use appendLeft instead of appendRight (#6407) (3012541)
- typo (#7064) (f38654f)
Features
- add fixStacktrace option to ssrLoadModule (#7048) (c703a33)
- cli: add command descriptions (#6991) (ffda8f0)
2.8.4 (2022-02-18)
Bug Fixes
- don't replace NODE_ENV in vite:client-inject (#6935) (2b70003)
- normalize postcss dependency messages (#6959) (3f3f473)
- revert #6935, bypass replacing process.env.NODE_ENV in ssr (#6970) (b8218b0)
2.8.3 (2022-02-15)
Bug Fixes
2.8.2 (2022-02-14)
Features
- custom manifest file name (#6667) (e385346)
- make
import.meta.glob
andimport.meta.globEager
generic (#5073) (78e84c8)
Performance Improvements
2.8.1 (2022-02-11)
Bug Fixes
- deps: update all non-major dependencies (#6782) (e38be3e)
- scan: escape for virtual modules (#6863) (de20c73)
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
- revert #6233, strip query when resolving entry (fix #6797) (a012644)
- ssr: skip vite resolve for windows absolute path (#6764) (489a7f1)
- revert #5342, only run build-html plugin on bundler inputs (#6715) (59f8a63)
- build: NODE_ENV override by .env (#6303) (7329b24)
- debug
dotenv
when specifically scoped (#6682) (c2f0021) - dev: prevent stripping query params from CSS in HMR (#6589) (3ab96c6)
- legacy: fix conflict with the modern build on css emitting (#6584) (f48255e), closes #3296 #3317 /github.com/vitejs/vite/commit/6bce1081991501f3779bff1a81e5dd1e63e5d38e#diff-2cfbd4f4d8c32727cd8e1a561cffbde0b384a3ce0789340440e144f9d64c10f6R262-R263
- revert #5601 #6025, don't resolve rollupOptions.input (#6680) (2a9da2e)
- update SSR externals only when SSR is enabled (fix #6478) (#6492) (28d1e7e)
- avoid referencing importGlob from importMeta.d.ts (#6531) (962d285)
- config: merge array correctly (#6499) (b2d972e)
- improve alias merging (#6497) (e57d8c6)
- improve array config merging (#6344) (028cbeb)
- merge debug params instead of overwrite (#6504) (#6505) (1ac7fb1)
- only run build-html plugin on bundler inputs (fix #4067) (#5342) (7541a8d)
- ssr: avoid using
tryNodeResolve
on absolute paths (#6488) (f346d89) - ssr: fix resolution for nested ssr externals (#6080) (#6470) (4a764f5)
- ssr: handle nameless descture in function args (#6489) (debc08d)
- ssr: should correctly transfrom identifier in ssr (#6548) (15cd975)
- types: add missing options parameter to importMeta (#6433) (ccf7d79)
- types: dynamic import in import.meta (#6456) (5d7b4c3), closes #6433
- update preview port to 4173 (#6330) (870e1c0)
- use cacheDir for resolveHttpsConfig (#6416) (647168b)
- improve array config merging (#6344) (028cbeb)
- only run build-html plugin on bundler inputs (fix #4067) (#5342) (7541a8d)
- ssr: handle nameless descture in function args (#6489) (debc08d)
- types: add missing options parameter to importMeta (#6433) (ccf7d79)
- types: dynamic import in import.meta (#6456) (5d7b4c3), closes #6433
- use cacheDir for resolveHttpsConfig (#6416) (647168b)
- build: fix chokidar.ignore override (#6317) (aa47549)
- build: fix watch crash with inline module (#6373) (49d2f6d)
- check if e.stack exists in the first place (#6362) (f144aa9)
- correct ssr flag in resolve calls (fix #6213) (#6216) (6dd7d1a)
- css: no emit assets in html style tag (fix #5968) (#6321) (dc9fce1)
- don't force terser on non-legacy (fix #6266) (#6272) (1da104e)
- prevent dev server crashing on malformed URI (fix #6300) (#6308) (a49d723)
- replace chalk with picocolors (#6277) (5a111ce)
- replace execa with cross-spawn (#6299) (f68ed8b)
- ssr: move
vite:ssr-require-hook
after user plugins (#6306) (d856c4b) - strip NULL_BYTE_PLACEHOLDER before transform (#6390) (5964949)
- strip query when resolving entry (#6233) (000ba2e)
- upgrade postcss-modules (#6248) (ac3f434)
- use
hires: true
for SSR require hook source map (#6310) (0ebeb98)
Features
- add lerna workspace support to
searchForWorkspaceRoot
(#6270) (0e164f8) - add .txt file format to assets (#6265) (e87ae41)
- allow globs in node_modules when pattern is explicit (#6056) (669d7e0)
- html: html simple script tag support import-expression (#6525) (3546d4f)
- add customResolver option to resolve.alias (#5876) (6408a3a)
- new Worker can bundle URL('path', import.meta.url) script (fix #5979) (#6356) (a345614)
- catch postcss error messages (#6293) (4d75b2e)
- define: prevent assignment (#5515) (6d4ee18)
- import.meta.glob support ?raw (#5545) (5279de6)
- option to disable pre-transform (#6309) (2c14525)
- server: support headers configurable (#5580) (db36e81)
- server: trace
error.loc
back to original source (#5467) (65cd44d) - ssr: support preload dynamic css file in html head (#5705) (07fca95)
- support .cjs config file (#5602) (cddd986)
- vite: pass mode to preview command (#6392) (1ff1103)
- worker: support worker format, plugins and rollupOptions (fix #6191) (#6351) (133fcea)
Beta Changelogs
2.8.0-beta.7 (2022-02-08)
2.8.0-beta.6 (2022-02-07)
2.8.0-beta.5 (2022-02-02)
2.8.0-beta.4 (2022-01-31)
2.8.0-beta.3 (2022-01-18)
2.8.0-beta.2 (2022-01-13)
2.8.0-beta.1 (2022-01-06)
2.8.0-beta.0 (2022-01-05)
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
2.7.5 (2021-12-21)
Bug Fixes
- asset: import assets from encodeURI(#6195) (#6199) (4114f84)
- hmr full-reload encodeURI path (#6212) (46b862a)
- remove top-level imports in importMeta.d.ts, fixes augmentation (#6214) (6b8d94d), closes #6194 #6211 #6206 #6205
- ssr: handle object destructure alias, close #6222 (#6224) (1d97ec3)
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
- html: empty script (#6057) (1487223)
- lexGlobPattern: edge case of glob import (#6022) (d4c5cff)
- ws types (#6083) (1ded1a8)
2.7.1 (2021-12-07)
Bug Fixes
2.7.0 (2021-12-07)
🎉 Revamped SSR dependency handling🧩 API consolidation🛑 server.fs.strict by default
BREAKING CHANGES
server.fs.strict
istrue
by default (#5341) See server filesystem restriction docs for more details.- Plugin hooks
ssr
param to object inresolveId
,load
, andtransform
(#5253) Previous to this release, thessr
param was passed as aboolean
in the last parameter of each hook. The new interface for these hooks is now: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.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; }
server.pluginContainer
options object forresolveId
,load
, andtransform
(#5294)- Normalize scripts and commands naming (#5207)
Adds a new
vite dev
command alias forvite serve
, preparing for the new release of create-vite where package scripts are renamed todev
,build
, andpreview
. - 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
2.7.0-beta.10 (2021-12-02)
Bug Fixes
- invalidate inlined proxy scripts on change (#5891) (5b8c58b)
- read the correct package.json in ssrExternal (#5927) (7edabb4), closes #5890
- resolve: dont overwrite
isRequire
frombaseOptions
(#5872) (2b91e5a) - scan: handle local scripts with lang=ts (#5850) (7ed8702)
- SSR import in dev can't resolve default import (fix #5706) (#5923) (21d79d7)
- ssr: skip dedupe require if noExternal true (#5928) (f6aa7fe)
2.7.0-beta.9 (2021-11-27)
Bug Fixes
isBuiltin
using patched nativebuiltinModules
(#5827) (4a05a6e)- always bundle config file, fix config hmr (#5779) (19d2b6a)
- build pluginContext types error (#5846) (c278439)
- circular dependency hmr causes refresh crash (#4589) (00d8c9b)
- replace asset references in CSS returned to JS (#5729) (880026e)
- resolve addons using nodeResolve() (#5809) (d288772)
- throw full error causing preprocessor to not load (#5816) (f6fcd21)
- Unicode path html entry point (#5821) (#5823) (2048195)
- unminified build breaks __vitePreload (#5785) (757a74a)
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
2.7.0-beta.7 (2021-11-17)
Bug Fixes
- build: keep IIFE name after minifying (fix #5490) (#5715) (1544211)
- scan: correctly resolve virtual modules (#5711) (01f9b16)
- ssr: skip dedupe require in esm (#5714) (9666446)
2.7.0-beta.6 (2021-11-16)
Bug Fixes
- dev: Fix infinite recursion on query imports (#5671) (#5674) (bce4e56)
- ssr: avoid resolving ESM for CJS dependencies (#5693) (b937ea4)
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
- build: resolve
rollupOptions.input
paths (#5601) (5b6b016) - check exactly in proxyESM (#5512) (a17da55)
- handle local and module scripts separately (#5464) (0713446)
- logger: no sameCount if clearScreen is false (#5648) (afd6b6d)
- server: watch correct env files (#5520) (03b77bd)
- sourcemap: tolerate virtual modules in
sources
array (#5587) (cfd2c5e) - ssr: use
tryNodeResolve
instead ofresolveFrom
(#3951) (87c0050) - use micromatch for consistent glob matching (#5610) (9d50df8)
- vitepress/theme in ssrExternals (#5651) (1f91cdb)
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 oftransformRequest
calls (#5391) (27b7f90) - Windows path error on script proxying (#5556) (f8dc1ee)
Features
- importing ts files using their corresponding js extesions (#5510) (7977e92)
- preview config (#5514) (ff755eb)
2.7.0-beta.1 (2021-11-01)
Bug Fixes
- ssr: dont transform process.env. in ssr (#5404) (1140981)
- Vite module graph race condition (#5470) (70fd32c)
2.7.0-beta.0 (2021-10-28)
Bug Fixes
- add
import
support tossrModuleLoader
(#5197) (baba1f9) - consider # as a valid dir symbol (fix #4701) (#4703) (52689c8)
- do not overwrite pendingReload promise (fix #5448) (#5452) (cc9c2da)
- exclude dependency of optimized dependency (fix: 5410) (#5411) (ebd4027)
- missing tags inject fallback (#5339) (3c44ac8)
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
- build: let top-level
this
refer toglobalThis
(#5312) (7e25429) - bundle ws types (#5340) (bc4a96c)
- client: fix typo in overlay config hint (#5343) (96591bf)
- consider deep imports in isBuiltIn (#5248) (269a1b6)
- ensure server.host is passed in preview-mode (fix #5387) (#5389) (61b4b39)
- load-fallback catch (#5412) (e73281c)
- restrict static middleware fs access (#5361) (1f4723b)
- ssr: ssrTransfrom with function declaration in scope, fix #4306 (#5376) (5306632)
Performance Improvements
2.6.10 (2021-10-18)
Bug Fixes
2.6.9 (2021-10-18)
2.6.8 (2021-10-18)
Bug Fixes
- avoid scan failures in .svelte and .astro files (#5193) (386ca79)
- deps: bump postcss-load-config to 3.1.0 (#5277) (b7e8a5c)
- html: tags prepend doctype regex (#5315) (256b2bb)
- improve HTML script proxying (#5279) (1d6e7bb)
- regEx for tag, fix #5285 (#5311) (3ac08cc)
- ssr: make import.meta.url be the filesystem URL (#5268) (7674cf2)
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
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
- dev: read property of undefined (#5177) (70e882f)
- type: update ExportsData type (b582581)
- upgrade to @rollup/plugin-commonjs 21.x (#5173) (c5bfc5e)
2.6.2 (2021-09-30)
Bug Fixes
- cli: log correct hostname (#5156) (6f977a5)
- properly handle postfix for getRealPath (#5149) (7d257c3)
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
- Allow custom asset URL origin in development (#5104) (e4ef6dd)
- avoid module preload polyfill for zero js html (#4999) (ac55755)
- injected tags indentation (#5000) (4b84c0d)
- lib-mode: do not minify lib mode es output (06d86e4), closes /github.com/vuejs/core/issues/2860#issuecomment-926882793
- normalize away
base
in imported URLs (#5065) (9164da0) - server.address before listen, chdir in test, basic cli test (#5059) (fb37a63)
- should load
--config foo.mjs
as an ES module (#5091) (5d2c50a) - types: missing return type on
logError
(#5067) (3c9f1a1) - use the same
target
for optimized dependencies and source files (#5095) (8456a6f), closes #4897
Features
- expose
preview
method (#5014) (9885656) - expose
searchForWorkspaceRoot
util (#4958) (d0f7bf1) - server.open supports absolute path (#5068) (2d6f682)
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
- default build.minify to esbuild (#5041) (e4892be)
- pre transform direct imports before requests hit the server (#5037) (57b9a37)
- support .astro files (#5038) (79ff0ec)
2.6.0-beta.0 (2021-09-20)
Bug Fixes
- avoid wrong warning of explicit public paths (#4927) (9e06b81)
- css: revert return sourcemap in vite:css transform (#4880) (#4951) (72cb33e)
- deps: update all non-major dependencies (#4545) (a44fd5d)
- do not include css string in bundle if not needed (3e3c203)
- docs for ssr manifest plugin and dedupe name (#4974) (1bd6d56)
- force overlay LTR (#4943) (f8d8b73)
- handle sourcemap: false in transformWithEsbuild (864d41d)
- normalize internal plugin names (#4976) (37f0b2f)
- ssr: add normalizePath to require.resolve, fix #2393 (#4980) (417208c)
- update *.wasm type (fix #4835) (#4881) (5e1b8d4)
- use pkgId to get relative path (#4957) (#4961) (b9e837a)
- websocket proxies not the same as http (#4893) (9260848)
Features
- add resolve.preserveSymlinks option (#4708) (b61b044)
- async script module support, close #3163 (#4864) (3984569)
- export transformWithEsbuild (#4882) (c8c0f74)
- html: Inline entry chunk when possible (#4555) (e687d98)
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
- allow
apply
condition to be a function (#4857) (f19282f) - ssr: exports
dynamicDeps
for ssrTransform, close #4898 (#4909) (9e51a76)
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
- decode url for middleware (#4728) (824d042)
- don't transform new URL(url, import.meta.url) in comments (#4732) (bf0b631)
- prevent pre-bundling @vite/client and @vite/env (#4716) (e8c1906)
- special handling for ssr.noExternal in mergeConfig (#4766) (689a2c8)
- ssr: resolve .cjs file extensions (#4772) (96712ad)
- unexpected file request with custom publicDir, fix #4629 (#4631) (7be6c0c)
Features
- add
.pdf
to list of known asset types (#4752) (d891641) - allow custom vite env prefix (#4676) (dfdb9cc)
- allow use of clientPort without middlewareMode (#4332) (da0abc5)
- optimizer: nested optimization (#4634) (f61ec46)
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
- Add
ssr.noExternal = true
option (#4490) (963387a) - make redirect easier when visit a non-based page (#4618) (b97afa7)
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
- add asset name (#3028) (#3050) (a055938)
- import
.webmanifest
assets as URL (#4515) (8c5ac3f) - log a warning if dependency pre-bundling cannot be run (#4546) (120f3b9)
2.5.0-beta.1 (2021-08-04)
Bug Fixes
- change the preview default mode from
development
toproduction
(#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
- ssr: tolerate circular imports (#3950) (69f91a1)
- implement custom logger (#2521) (59841f0)
- css: support css module compose/from path resolution (#4378) (690b35e)
- minify css with esbuild, deprecate build.cleanCssOptions (#4371) (4454688)
- modulepreload polyfill (#4058) (cb75dbd)
- respect tsconfig options that affects compilation results (#4279) (2986f6e)
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
- call createFileOnlyEntry() only for CSS deps, fix #4150 (#4267) (89e3160)
- dev: only rewrite SSR stacktrace when possible (#4248) (887c247)
- util: copyDir may cause an infinite loop (#4310) (da64197)
- correctly ignore optional deps when bundling vite deps (#4223) (b5ab77d), closes #3977 #3850
- do not end process in middleware mode, fix #4196 (#4232) (1c994f8)
- improve indent of built html file (#4227) (0316f14)
- nested dependencies from sub node_modules, fix #3254 (#4091) (b465d3e)
Features
vite preview
port is used automatically+1
(#4219) (179a057)- enable usage of function as library fileName, close #3585 (#3625) (772b2f7)
- extract
config.base
inimportAnalysisBuild.ts
(#4096) (ab59598) - library mode does not include preload (#4097) (decc7d8)
2.4.2 (2021-07-12)
Bug Fixes
- VITE_PRELOAD replacement error (#4163) (d377aae), closes #3051
- shutdown process after closing server (#4082) (eac779c)
- build: resolve license files correctly (#4149) (bf32b41)
- utils: add dot-all flag to match all characters, fix #3761 (#3780) (b9cdfbe)
Features
2.4.1 (2021-07-06)
Bug Fixes
- hmr: html registered as a PostCSS dependency, fix #3716 (#4127) (09c6c94)
- specify full filepath to importMeta.d.ts, fix #4125 (#4138) (3bc1d78)
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
- revert resolve nested dependencies #3753 (#4019) (b6f4293), closes #4005
- commonjs:
ignoreDynamicRequires
should default tofalse
(#4015) (c08069c), closes /github.com/vitejs/vite/pull/3353#issuecomment-851520683 #3426 #3997 - css: skip comma when matching css url (#4004) (7d0bc26)
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
2.4.0-beta.0 (2021-06-27)
BREAKING CHANGES
- server:
server.fsServe
renamed toserver.fs
(#3965) - server:
server.fs.root
deprecated in favor ofserver.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
- build: bundle non-inlined workers with rollup (#2494) (18a2208)
- resolve nested dependencies (#3254) (#3753) (8467f64)
- css: file or contents missing error in build watch (#3742) (#3747) (26b1b99)
- deps: update all non-major dependencies (#3878) (a66a805)
- scan: 'for await' support in script setup for dev server (#3889) (dd46cd1)
- scan: avoid breaking html comment regex inside script of scanned html-like files (bb095db)
- ssr: fix binding overwrite at nested function, fix #3856 (#3869) (85f51c1)
- ssr: normalize manifest filenames (#3706) (aa8ca3f), closes #3303
- ssr: not flatten export * as (fix #3934) (#3954) (7381d27)
- ssr: not importing browser exports, fix #3772 (#3933) (f623ba3)
- do not end server process in CI (#3659) (5999444)
- missing styles with build watch (#3742) (#3887) (c9a6efe)
- multiple css url separation (fix #3922) (#3926) (2d01e62)
- only downgrade target to es2019 when actually using terser (bd8723e)
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
ifprocess
not global variable (#3703) (5aeadb7) - upgrade esbuild for esm compatibility (#3718) (dbb5eab), closes #3399 #3413
Features
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
2.3.6 (2021-06-02)
Bug Fixes
- revert avoid css leaking into emitted javascript (#3402) (#3630) (91eb2a6)
- types: add '*?.sharedworker' typing (#3618) (690ff99)
2.3.5 (2021-06-01)
Bug Fixes
- cannot recognize JS url correctly(#3568) (#3572) (ab08652)
- tests: fix tests run fail in the Chinese directory (#3586) (3cab2c2)
- update esbuild to 0.12 (#3570) (421c530)
Features
- config: add
envDir
option (#3407) (472ba5d) - plugins/worker: support SharedWorker (resolve #2093) (#2505) (d78191c)
- ssr: include non-CSS assets in the manifest (#3556) (adc7170)
- added clientPort to HmrOptions (#3578) (7db69a3)
2.3.4 (2021-05-25)
Bug Fixes
- allow passing an array as sass / scss importer (#3529) (e344cdd)
- avoid css leaking into emitted javascript (#3402) (65d333d)
- clean manifest plugin state at build start (#3530) (c9da635)
- data-uri plugin cache reset at buildStart (#3537) (9d97b6d)
- do not cache module while the file contains import.meta.glob (#3005) (e7b8f41)
- ensure new assets cache at build start, fix #3271 (#3512) (9484c0f)
- ensure new CSS modules cache at build start (#3516) (07ad2b4)
- preview: #3487 preview should serve latest content by default (#3488) (9a4183d)
- preview: allow to disable HTTPS (#3514) (cf1632e)
- preview: support custom hostname (#3506) (5979d0e)
- types: add .module.pcss typings, fix #3518 (#3519) (3475351)
- handle HMR for files with more than one glob import (#3497) (05bd96e)
- inline webworker safari support (#3468) (2671546)
- invalidate import globs upon new/removed files (fix #3499) (#3500) (b31604e)
- track deps for css @import in build watch mode, fix #3387 (#3478) (13bda33)
Features
2.3.3 (2021-05-17)
Bug Fixes
- ignore ids that start with \0 in plugin asset, fix #3424 (#3436) (f6cfe30)
- restore dynamic-import-polyfill (#3434) (4112c5d)
- sass importer can't be undefined (fix: #3390) (#3395) (30ff5a2)
- skip fs fallback for out of root urls, fix #3364 (#3431) (19dae99)
- warn about dynamic import polyfill only during build (#3446) (5fe0550)
2.3.2 (2021-05-12)
Bug Fixes
- css: fix sass importer error (#3368) (3f04abf)
- server: hostname defaults to localhost, fix #3355 (#3383) (8b5a6a8)
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.
- Pass
- 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
orpnpm-workspace.yaml
- To set the workspace root explicitly, see configurations
Bug Fixes
- dev: rewrite importee path at html files at spa fallback (#3239) (13d41d8)
- hmr: respect server https options when running as middleware (#1992) (24178b0)
- serve: prevent serving unrestricted files (#3321) (7231b5a)
- only provide npm package names to resolveSSRExternal (#2717) (6dde32a)
- prevent serving unrestricted files (fix #2820) (#2850) (792a6e1)
- type error by #3151 (#3292) (fd4146b)
- upgrade to esbuild@0.11.19 (#3282) (b0dd69d)
- warning for vite/dynamic-import-polyfill (#3328) (8b80512)
- ci: fix ci lint step (#2988) (4e8ffd8)
- resolve: normalize node_modules and bare imports, fix #2503 (#2848) (0c97412)
- server: Listen only to 127.0.0.1 by default (#2977) (1e604d5)
- ssr: resolve dynamic import vars modules (#3177) (b1e7395)
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
- dev: strip utf-8 bom (#3162) (#3171) (19a2869)
- call
buildStart
hook in middleware mode (#3080) (c374a54) - scan: improve script regular matching (fixes #2942) (#2961) (1e785d1)
- dependencies are analyzed multiple times (#3154) (28a67ad)
- emptyOutDir: never remove .git (#3043) (82dc588)
Features
2.2.3 (2021-04-25)
Bug Fixes
- revert #2541, fix #3084 #3101 (#3144) (f4e7918)
- build: vendor chunk strategy uses static imports, fix #2672 (#2934) (949b818)
- add .svelte to list of known js src files (#3128) (0f09eaf)
- await bundle close in worker plugin (#2997) (0e7125a)
- dymamic import polyfill path when base is a URL (#3132) (02ba4ba)
- handle null/empty sources in source maps (#3074) (3e9f128)
- support postcss .pcss extension (#3130) (6d602a0)
2.2.2 (2021-04-24)
Bug Fixes
Features
2.2.1 (2021-04-19)
Bug Fixes
2.2.0 (2021-04-19)
Bug Fixes
- require.resolve to correct sub node_modules (#3003) (da11d43)
- optimizer: ensure consistency with replace define (#2929) (ddb7a91), closes #2893
- A static and dynamically imported module is loaded twice (#2935) (266fb55)
- avoid endless loop in resolveSSRExternal (fix #2635) (#2636) (59871ef)
- don't resolve import using browser during SSR (fix #2995) (#2996) (fd1c9ba)
- filter out empty srcset, fix #2863 (#2888) (0d4f803)
- build: avoid import duplicate chunks, fix #2906 (#2940) (8b02abf)
- build: properly handle alias key in config merge (#2847) (41261c7)
- build: support
cssCodeSplit
for cjs format, fix #2575 (#2621) (2a89c57) - css: properly pass options to stylus compiler, fix #2587 (#2860) (8dbebee)
- define: ensure the normal use of NODE_ENV, fix #2759 (#2764) (fa85749)
- scan: avoid crawling type only import (#2810) (daf7838)
- ssr: fix ssrTransform catch clause error (fix #2667) (#2966) (c9e0bcf)
- types: clean-css types (#2971) (9be7449)
- chunks are analysed multiple times (#2541) (1451b78)
- serve .js, .jsx, .ts, .tsx as application/javascript, fix #2642 (#2769) (b08e973)
Features
- createLogger: allow custom prefix for logger (#2019) (344d77e)
- add async support for vite config file (#2758) (aee8b37)
- add inlineConfig.envFile option (#2475) (81b80c6)
- export manifest types (#2901) (ffcb7ce)
- parameter settings when packaging the library (#2750) (f17e19a)
- support cacheDir (#2899) (57980d2)
- watch the dependencies of config file (#3031) (bb419cb)
- cli: build watch mode, fix #1434 (#1449) (0dc6e37)
- plugin: plugin config hook supports return promise (#2800) (5dfd0e8)
- plugin-api: support async configResolved hooks (fixes #2949) (#2951) (8b38168)
- support globbing from dependencies (#2519) (7121553), closes #2390
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
- scan: properly crawl imports in lang=ts blocks in vue/svelte files (8f527fd)
- invalidate module cache on unlinked (#2629), fix #2630 (57f2a69)
- reload only once on socket reconnect (#2340) (d73c1fa)
- client: don't inject queries for data URLs (#2703), fix #2658 (86753d6)
- resolve: fix resolver not following node resolve algorithm (#2718), fix #2695 (669c591)
- resolve: improve browser filed substitutions (#2701), fix #2598 (cc213c6)
- fix types errors (#2726) (9716582)
Features
2.1.3 (2021-03-25)
Bug Fixes
- add a timeout to the res.sep when discovering dependencies, fix #2525 (#2548) (31d10cb)
- handle paths with special characters in injectQuery (fix #2585) (#2614) (ed321ba)
- css: alias for background url in sass/less link error (fix #2316) (#2323) (9499d26)
- dev: remove process listeners on server close (#2619) (74b360b)
- json should be bundled (#2573) (2eb7682), closes #2543
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
- serving static files from root (#2309) (4f942be)
- scan: handle race condition for tempDir removal (#2299) (67e56e4)
- await bundle close (#2313) (c988574)
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 oncss.modules
(#2025) (e324e36)
BREAKING CHANGES
define
option no longer callsJSON.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
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)