You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/migration.md
+40-4Lines changed: 40 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,18 @@ A small fraction of users will now require using [@vitejs/plugin-legacy](https:/
19
19
20
20
- The following options that were already deprecated in v2 have been removed:
21
21
22
-
-`optimizeDeps.keepNames` (switch to [`optimizeDeps.esbuildOptions.keepNames`](../config/dep-optimization-options.md#optimizedepsesbuildoptions))
23
-
-`build.base` (switch to [`base`](../config/shared-options.md#base))
24
22
-`alias` (switch to [`resolve.alias`](../config/shared-options.md#resolvealias))
25
23
-`dedupe` (switch to [`resolve.dedupe`](../config/shared-options.md#resolvededupe))
26
-
-`polyfillDynamicImport` (use [`@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) for browsers without dynamic import support)
24
+
-`build.base` (switch to [`base`](../config/shared-options.md#base))
25
+
-`build.brotliSize` (switch to [`build.reportCompressedSize`](../config/build-options.md#build-reportcompressedsize))
26
+
-`build.cleanCssOptions` (Vite now uses esbuild for CSS minification)
27
+
-`build.polyfillDynamicImport` (use [`@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) for browsers without dynamic import support)
28
+
-`optimizeDeps.keepNames` (switch to [`optimizeDeps.esbuildOptions.keepNames`](../config/dep-optimization-options.md#optimizedepsesbuildoptions))
27
29
28
30
## Dev Server Changes
29
31
32
+
Vite's default dev server port is now 5173. You can use [`server.port`](../config/server-options.md#server-port) to set it to 3000.
33
+
30
34
Vite optimizes dependencies with esbuild to both convert CJS-only deps to ESM and to reduce the number of modules the browser needs to request. In v3, the default strategy to discover and batch dependencies has changed. 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.
31
35
32
36
To get back the v2 strategy, you can use [`optimizeDeps.devScan`](../config/dep-optimization-options.md#optimizedepsdevscan).
@@ -45,9 +49,41 @@ If using ESM for SSR isn't possible in your project, you can set `ssr.format: 'c
45
49
46
50
## General Changes
47
51
52
+
- 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.
53
+
54
+
### `import.meta.glob`
55
+
48
56
-[Raw `import.meta.glob`](features.md#glob-import-as) switched from `{ assert: { type: 'raw' }}` to `{ as: 'raw' }`
57
+
- Keys of `import.meta.glob` are now relative to the current module.
49
58
50
-
- 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.
59
+
```diff
60
+
// file: /foo/index.js
61
+
const modules = import.meta.glob('../foo/*.js')
62
+
63
+
// transformed:
64
+
const modules = {
65
+
- '../foo/bar.js': () => {}
66
+
+ './bar.js': () => {}
67
+
}
68
+
```
69
+
70
+
- When using an alias with `import.meta.glob`, the keys are always absolute.
71
+
-`import.meta.globEager` is now deprecated. Use `import.meta.glob('*', { eager: true })` instead.
72
+
73
+
### WebAssembly support
74
+
75
+
`import init from 'example.wasm'` syntax is dropped to prevent future collision with ["ESM integration for Wasm"](https://github.com/WebAssembly/esm-integration).
76
+
You can use `?init` which is similar to the previous behavior.
0 commit comments