Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/create-vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,9 @@ import babel from '@rolldown/plugin-babel'`,
)
updateReactCompilerReadme(
root,
'The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.\n\nNote: This will impact Vite dev & build performances.',
'The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.\n\n' +
'Note: This will impact Vite dev & build performances.\n' +
'You can also try [the experimental native React Compiler support in plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md#rust-react-compiler) by using `compiler: true` in the plugin options instead of using the Babel plugin.',
)
}

Expand Down
45 changes: 45 additions & 0 deletions packages/vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
## <small>[8.2.2](https://github.com/vitejs/vite/compare/v8.2.1...v8.2.2) (2026-08-20)</small>
### Features

* **deps:** widen `@vitejs/devtools` peer range to v0.5.0 ([#23302](https://github.com/vitejs/vite/issues/23302)) ([495d9ff](https://github.com/vitejs/vite/commit/495d9ff5a7d843ca876a9e49799947a5deb704c7))

### Bug Fixes

* **bundled-dev:** handle lazy request error ([#23291](https://github.com/vitejs/vite/issues/23291)) ([3ba026d](https://github.com/vitejs/vite/commit/3ba026dade4af56df08815310d3458fa110f5c5c))
* **bundled-dev:** hot update through circular imports instead of reloading ([#23259](https://github.com/vitejs/vite/issues/23259)) ([3dbddef](https://github.com/vitejs/vite/commit/3dbddefaafc091a879b06f9279296f776691e455))
* **config:** resolve sourcemap paths against sourcemap location ([#23239](https://github.com/vitejs/vite/issues/23239)) ([05a003e](https://github.com/vitejs/vite/commit/05a003e6a17a84d75f907ea0f1598bc39b8dce6c))
* **css:** don't pass empty targets to lightningcss ([#23295](https://github.com/vitejs/vite/issues/23295)) ([2804636](https://github.com/vitejs/vite/commit/2804636ff608d105928009d274ffba7cfbe55340))
* **define:** fix match escaped dots to support $-prefixed define keys ([#23249](https://github.com/vitejs/vite/issues/23249)) ([dcf88bd](https://github.com/vitejs/vite/commit/dcf88bd2ad2b1a8845f9029587cc8c825e382d42))
* **deps:** update all non-major dependencies ([#23217](https://github.com/vitejs/vite/issues/23217)) ([ba958bd](https://github.com/vitejs/vite/commit/ba958bddfc9cabe302c6b34269dcf5c9634531e0))
* **deps:** update rolldown-related dependencies ([#23218](https://github.com/vitejs/vite/issues/23218)) ([83ecb2c](https://github.com/vitejs/vite/commit/83ecb2c8059e8ce946a7cc835d4c14ef78aef4fd))
* **module-runner:** exclude completed modules from in-flight cycle detection (fix [#22999](https://github.com/vitejs/vite/issues/22999)) ([#23009](https://github.com/vitejs/vite/issues/23009)) ([d9b10a9](https://github.com/vitejs/vite/commit/d9b10a98db1c293ee64300bd75d568b44c8ae931))
* **optimizer:** close custom extension analysis bundles ([#23207](https://github.com/vitejs/vite/issues/23207)) ([8fb7675](https://github.com/vitejs/vite/commit/8fb76752836f61224d3095b502fa237b478a06b2))
* reduce Windows 8.3-short-name detection false-positives ([#23066](https://github.com/vitejs/vite/issues/23066)) ([02cffa9](https://github.com/vitejs/vite/commit/02cffa9e2d38d5d8f12e4043ee9d0f7abb1471e2))
* respect `resolve.preserveSymlinks` when resolving root (fix [#23197](https://github.com/vitejs/vite/issues/23197)) ([#23198](https://github.com/vitejs/vite/issues/23198)) ([8413052](https://github.com/vitejs/vite/commit/8413052731836d4aaf3eb94a0f25788dd35d2888))
* **ssr:** rewrite computed key of destructing parameter ([#23307](https://github.com/vitejs/vite/issues/23307)) ([9db0b61](https://github.com/vitejs/vite/commit/9db0b61d4c9c7caad7ea1d9670b637faf2bb6c93))
* **vite:** update outdated upstream file links in license comments ([#23285](https://github.com/vitejs/vite/issues/23285)) ([c0f2fc6](https://github.com/vitejs/vite/commit/c0f2fc607ee97ee4499337b04826420c00654065))

### Documentation

* **build:** note cssTarget precedence ([#23200](https://github.com/vitejs/vite/issues/23200)) ([a20a35e](https://github.com/vitejs/vite/commit/a20a35ec0685e374519864d0f41dd5f6e9ba0271))

### Miscellaneous Chores

* fix ts errors in build test cases ([#23209](https://github.com/vitejs/vite/issues/23209)) ([a0cfcf7](https://github.com/vitejs/vite/commit/a0cfcf72f8ef8bf0f2f11d553333b9bb31f1d316))

### Code Refactoring

* use JSON import attributes instead of readFileSync in constants ([#23258](https://github.com/vitejs/vite/issues/23258)) ([1d9fa39](https://github.com/vitejs/vite/commit/1d9fa392a43229241f80630236f8552ce8f7cd0f))
* use named regex constants over inline literals ([#22964](https://github.com/vitejs/vite/issues/22964)) ([5c1c6c6](https://github.com/vitejs/vite/commit/5c1c6c609718303202832f706884192e1f1e9223))

### Tests

* **define:** close rolldown bundler after generate ([#23231](https://github.com/vitejs/vite/issues/23231)) ([b4d66fe](https://github.com/vitejs/vite/commit/b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab))
* **module-runner:** add TLA circular import case ([#23299](https://github.com/vitejs/vite/issues/23299)) ([4a261f2](https://github.com/vitejs/vite/commit/4a261f242831bef92afd2f1aacfb81eab9dec371))
* **module-runner:** simplify server-hmr tests ([#23300](https://github.com/vitejs/vite/issues/23300)) ([599b44b](https://github.com/vitejs/vite/commit/599b44b6600ec426e10cd556908d53b027b0c4fb))
* **ssr:** add destructing assignment case for moduleRunnerTransform ([#23308](https://github.com/vitejs/vite/issues/23308)) ([cb77e2a](https://github.com/vitejs/vite/commit/cb77e2a93bad2a8ece00b4aa0ef507c092582c45))

### Build System

* use JSON import attributes instead of readFIleSync in rolldown configs ([#23251](https://github.com/vitejs/vite/issues/23251)) ([d615bcd](https://github.com/vitejs/vite/commit/d615bcdb23d96c1ca5ce1ee45e21d8d87381106f))

## <small>[8.2.1](https://github.com/vitejs/vite/compare/v8.2.0...v8.2.1) (2026-08-06)</small>
### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite",
"version": "8.2.1",
"version": "8.2.2",
"description": "Native-ESM powered web dev build tool",
"keywords": [
"build-tool",
Expand Down
92 changes: 92 additions & 0 deletions packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,63 @@ function c({ _ = bar() + foo() }) {}
`)
})

// #23232
test('function argument destructure with a default parameter', async () => {
expect(
await ssrTransformSimpleCode(
`
import { key } from 'foo'
function noParameterDefault({ [key]: value = null }) {}
function declaration({ [key]: value = null } = {}) {}
function compound({ [key.name]: value } = {}) {}
const arrow = ({ [key]: value = null } = {}) => {}
function nested({ a: { [key]: value } = {} } = {}) {}
function array([{ [key]: value } = {}] = []) {}
class Foo { method({ [key]: value } = {}) {} }
`,
),
).toMatchInlineSnapshot(`
"const __vite_ssr_import_0__ = await __vite_ssr_import__("foo", {"importedNames":["key"]});


function noParameterDefault({ [__vite_ssr_import_0__.key]: value = null }) {}
function declaration({ [__vite_ssr_import_0__.key]: value = null } = {}) {}
function compound({ [__vite_ssr_import_0__.key.name]: value } = {}) {}
const arrow = ({ [__vite_ssr_import_0__.key]: value = null } = {}) => {};
function nested({ a: { [__vite_ssr_import_0__.key]: value } = {} } = {}) {}
function array([{ [__vite_ssr_import_0__.key]: value } = {}] = []) {}
class Foo { method({ [__vite_ssr_import_0__.key]: value } = {}) {} }
"
`)
})

test('function argument destructure with a default parameter preserves shadowing', async () => {
expect(
await ssrTransformSimpleCode(
`
import { key } from 'foo'
function shorthand({ key } = {}) { return key }
function aliased({ prop: key } = {}) { return key }
function defaulted({ key = 'default' } = {}) { return key }
function array([key] = []) { return key }
function plain(key) { return key }
console.log(key)
`,
),
).toMatchInlineSnapshot(`
"const __vite_ssr_import_0__ = await __vite_ssr_import__("foo", {"importedNames":["key"]});


function shorthand({ key } = {}) { return key }
function aliased({ prop: key } = {}) { return key }
function defaulted({ key = 'default' } = {}) { return key }
function array([key] = []) { return key }
function plain(key) { return key }
console.log((0,__vite_ssr_import_0__.key))
"
`)
})

test('object destructure alias', async () => {
expect(
await ssrTransformSimpleCode(
Expand Down Expand Up @@ -824,6 +881,41 @@ const foo = {}
`)
})

test('destructuring assignments', async () => {
expect(
await ssrTransformSimpleCode(`
import { key } from 'foo'
let value
const object = {}
;({ [key]: value = key } = object)
;[value = key] = []

function shadowed(key) {
;({ key } = object)
;({ alias: key } = object)
;[key] = []
return key
}
`),
).toMatchInlineSnapshot(`
"const __vite_ssr_import_0__ = await __vite_ssr_import__("foo", {"importedNames":["key"]});


let value;
const object = {}
;({ [__vite_ssr_import_0__.key]: value = __vite_ssr_import_0__.key } = object)
;[value = __vite_ssr_import_0__.key] = [];

function shadowed(key) {
;({ key } = object)
;({ alias: key } = object)
;[key] = [];
return key
}
"
`)
})

test('nested object destructure alias', async () => {
expect(
await ssrTransformSimpleCode(
Expand Down
34 changes: 2 additions & 32 deletions packages/vite/src/node/ssr/ssrTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,38 +575,8 @@ function walk(
if (node.type === 'FunctionExpression' && node.id) {
setScope(node, node.id.name)
}
// walk function expressions and add its arguments to known identifiers
// so that we don't prefix them
node.params.forEach((p) => {
if (p.type === 'ObjectPattern' || p.type === 'ArrayPattern') {
handlePattern(p, node)
return
}
;(eswalk as any)(p.type === 'AssignmentPattern' ? p.left : p, {
enter(child: ESTree.Node, parent: ESTree.Node | undefined) {
// skip params default value of destructure
if (
parent?.type === 'AssignmentPattern' &&
parent.right === child
) {
return this.skip()
}
if (child.type !== 'Identifier') return
// do not record as scope variable if is a destructuring keyword
if (isStaticPropertyKey(child, parent)) return
// do not record if this is a default value
// assignment of a destructuring variable
if (
(parent?.type === 'TemplateLiteral' &&
parent.expressions.includes(child as ESTree.Expression)) ||
(parent?.type === 'CallExpression' && parent.callee === child)
) {
return
}
setScope(node, child.name)
},
})
})
// add function arguments to known identifiers so that we don't prefix them
node.params.forEach((p) => handlePattern(p, node))
} else if (node.type === 'ClassDeclaration') {
// A class declaration name could shadow an import, so add its name to the parent scope
const parentScope = findParentScope(parentStack)
Expand Down
Loading