diff --git a/docs/_data/team.js b/docs/_data/team.js
index 8a30fb222cf2ba..54f089f613c6c3 100644
--- a/docs/_data/team.js
+++ b/docs/_data/team.js
@@ -66,7 +66,7 @@ export const core = [
title: 'Developer',
org: 'Vue.js',
orgLink: 'https://vuejs.org/',
- desc: 'Vite/Vite core team member. Full-time open sourcerer.',
+ desc: 'Vue/Vite core team member. Full-time open sourcerer.',
links: [
{ icon: 'github', link: 'https://github.com/sodatea' },
{ icon: 'twitter', link: 'https://twitter.com/haoqunjiang' },
diff --git a/docs/guide/migration.md b/docs/guide/migration.md
index c4e9c9b28e2e67..ec355c9890218b 100644
--- a/docs/guide/migration.md
+++ b/docs/guide/migration.md
@@ -2,7 +2,7 @@
## Rollup 3
-Vite is now using [Rollup 3](https://github.com/vitejs/vite/issues/9870), which allowed us to simplify Vite's internal asset handling and has many improvements. See the [Rollup 3 release notes here](https://github.com/rollup/rollup/releases).
+Vite is now using [Rollup 3](https://github.com/vitejs/vite/issues/9870), which allowed us to simplify Vite's internal asset handling and has many improvements. See the [Rollup 3 release notes here](https://github.com/rollup/rollup/releases/tag/v3.0.0).
Rollup 3 is mostly compatible with Rollup 2. If you are using custom [`rollupOptions`](../config/build-options.md#rollup-options) in your project and encounter issues, refer to the [Rollup migration guide](https://rollupjs.org/guide/en/#migration) to upgrade your config.
diff --git a/docs/plugins/index.md b/docs/plugins/index.md
index 4d502384c43416..dd7cfce8733419 100644
--- a/docs/plugins/index.md
+++ b/docs/plugins/index.md
@@ -22,11 +22,11 @@ Check out [Using Plugins](../guide/using-plugins) for information on how to use
### [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react)
-- Uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the Babel transform pipeline.
+- Uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the Babel transform pipeline. Without additional Babel plugins, only esbuild is used during builds.
### [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc)
-- Uses esbuild during build, but replaces Babel with SWC during development. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster.
+- Replaces Babel with SWC during development. During builds, SWC+esbuild are used when using plugins, and esbuild only otherwise. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster.
### [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy)
diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md
index f4d4ca6dbe971f..01b8c71e5dea83 100644
--- a/packages/vite/CHANGELOG.md
+++ b/packages/vite/CHANGELOG.md
@@ -1,3 +1,16 @@
+## 4.1.3 (2023-02-20)
+
+* fix: catch and handle websocket error (#11991) (#12007) ([4b5cc9f](https://github.com/vitejs/vite/commit/4b5cc9f)), closes [#11991](https://github.com/vitejs/vite/issues/11991) [#12007](https://github.com/vitejs/vite/issues/12007)
+* fix: do not append version query param when scanning for dependencies (#11961) ([575bcf6](https://github.com/vitejs/vite/commit/575bcf6)), closes [#11961](https://github.com/vitejs/vite/issues/11961)
+* fix(css): handle pure css chunk heuristic with special queries (#12091) ([a873af5](https://github.com/vitejs/vite/commit/a873af5)), closes [#12091](https://github.com/vitejs/vite/issues/12091)
+* fix(esbuild): umd helper insert into wrong position in lib mode (#11988) ([86bc243](https://github.com/vitejs/vite/commit/86bc243)), closes [#11988](https://github.com/vitejs/vite/issues/11988)
+* fix(html): respect disable modulepreload (#12111) ([6c50119](https://github.com/vitejs/vite/commit/6c50119)), closes [#12111](https://github.com/vitejs/vite/issues/12111)
+* fix(html): rewrite assets url in `
+
This should be magenta
+
diff --git a/playground/css-codesplit/main.js b/playground/css-codesplit/main.js
index e128734112ee5a..e548142add8786 100644
--- a/playground/css-codesplit/main.js
+++ b/playground/css-codesplit/main.js
@@ -2,6 +2,12 @@ import './style.css'
import './main.css'
import './order'
+import './chunk.css'
+import chunkCssUrl from './chunk.css?url'
+
+// use this to not treeshake
+globalThis.__test_chunkCssUrl = chunkCssUrl
+
import('./async.css')
import('./inline.css?inline').then((css) => {
diff --git a/playground/css-codesplit/other.js b/playground/css-codesplit/other.js
index cab743adef7757..4560c4d53c29ac 100644
--- a/playground/css-codesplit/other.js
+++ b/playground/css-codesplit/other.js
@@ -1 +1,6 @@
import './style.css'
+import './chunk.css'
+import chunkCssUrl from './chunk.css?url'
+
+// use this to not treeshake
+globalThis.__test_chunkCssUrl = chunkCssUrl
diff --git a/playground/css-codesplit/vite.config.js b/playground/css-codesplit/vite.config.js
index 7f493850ff10d5..870060f7e6c382 100644
--- a/playground/css-codesplit/vite.config.js
+++ b/playground/css-codesplit/vite.config.js
@@ -8,6 +8,14 @@ module.exports = {
main: resolve(__dirname, './index.html'),
other: resolve(__dirname, './other.js'),
},
+ output: {
+ manualChunks(id) {
+ // make `chunk.css` it's own chunk for easier testing of pure css chunks
+ if (id.includes('chunk.css')) {
+ return 'chunk'
+ }
+ },
+ },
},
},
}
diff --git a/playground/lib/__tests__/lib.spec.ts b/playground/lib/__tests__/lib.spec.ts
index 5940f8ed0a93ce..ce309a2285fe98 100644
--- a/playground/lib/__tests__/lib.spec.ts
+++ b/playground/lib/__tests__/lib.spec.ts
@@ -19,7 +19,9 @@ describe.runIf(isBuild)('build', () => {
const noMinifyCode = readFile('dist/nominify/my-lib-custom-filename.umd.js')
// esbuild helpers are injected inside of the UMD wrapper
expect(code).toMatch(/^\(function\(/)
- expect(noMinifyCode).toMatch(/^\(function\(global/)
+ expect(noMinifyCode).toMatch(
+ /^\(function\(global.+?"use strict";var.+?function\smyLib\(/s,
+ )
})
test('iife', async () => {
diff --git a/playground/lib/src/main.js b/playground/lib/src/main.js
index ca7adf0a873ae6..59c8e897cb0789 100644
--- a/playground/lib/src/main.js
+++ b/playground/lib/src/main.js
@@ -6,4 +6,7 @@ export default function myLib(sel) {
// Env vars should not be replaced
console.log(process.env.NODE_ENV)
+
+ // make sure umd helper has been moved to the right position
+ console.log(`amd function(){ "use strict"; }`)
}
diff --git a/playground/optimize-deps/__tests__/optimize-deps.spec.ts b/playground/optimize-deps/__tests__/optimize-deps.spec.ts
index 2137d068372c6a..bb0841e5b72f65 100644
--- a/playground/optimize-deps/__tests__/optimize-deps.spec.ts
+++ b/playground/optimize-deps/__tests__/optimize-deps.spec.ts
@@ -143,6 +143,12 @@ test('import aliased package with colon', async () => {
expect(await page.textContent('.url')).toBe('vitejs.dev')
})
+test('import aliased package using absolute path', async () => {
+ expect(await page.textContent('.alias-using-absolute-path')).toBe(
+ 'From dep-alias-using-absolute-path',
+ )
+})
+
test('variable names are reused in different scripts', async () => {
expect(await page.textContent('.reused-variable-names')).toBe('reused')
})
diff --git a/playground/optimize-deps/dep-alias-using-absolute-path/index.js b/playground/optimize-deps/dep-alias-using-absolute-path/index.js
new file mode 100644
index 00000000000000..82b1f4d1f0874f
--- /dev/null
+++ b/playground/optimize-deps/dep-alias-using-absolute-path/index.js
@@ -0,0 +1,13 @@
+// Importing a shared dependency used by other modules,
+// so dependency optimizer creates a common chunk.
+// This is used to setup a test scenario, where dep scanner
+// could not determine all of the used dependencies on first
+// pass, e.g., a dependency that is aliased using an absolute
+// path, in which case it used to trigger unnecessary "full
+// reloads" invalidating all modules in a module graph.
+const cloneDeep = require('lodash/cloneDeep')
+
+// no-op, using imported module for sake of completeness
+module.exports = cloneDeep({
+ message: 'From dep-alias-using-absolute-path',
+}).message
diff --git a/playground/optimize-deps/dep-alias-using-absolute-path/package.json b/playground/optimize-deps/dep-alias-using-absolute-path/package.json
new file mode 100644
index 00000000000000..3a43490c40ba48
--- /dev/null
+++ b/playground/optimize-deps/dep-alias-using-absolute-path/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "@vitejs/test-dep-alias-using-absolute-path",
+ "private": true,
+ "version": "1.0.0",
+ "main": "index.js",
+ "dependencies": {
+ "lodash": "^4.17.21"
+ }
+}
diff --git a/playground/optimize-deps/dynamic-use-dep-alias-using-absolute-path.js b/playground/optimize-deps/dynamic-use-dep-alias-using-absolute-path.js
new file mode 100644
index 00000000000000..784123a81ec685
--- /dev/null
+++ b/playground/optimize-deps/dynamic-use-dep-alias-using-absolute-path.js
@@ -0,0 +1,6 @@
+// This is used to setup a test scenario, where dep scanner
+// could not determine all of the used dependencies on first
+// pass, e.g., a dependency that is aliased using an absolute
+// path, in which case it used to trigger unnecessary "full
+// reloads" invalidating all modules in a module graph.
+export { default } from '@vitejs/test-dep-alias-using-absolute-path'
diff --git a/playground/optimize-deps/index.html b/playground/optimize-deps/index.html
index 2e24f421542fe7..921bf244c08d8d 100644
--- a/playground/optimize-deps/index.html
+++ b/playground/optimize-deps/index.html
@@ -83,6 +83,9 @@