Avatar for the swc-project user
swc-project
swc
BlogDocsChangelog

Performance History

Latest Results

react-compiler: skip TypeScript this pseudo-params in scope collector TypeScript allows function f(this: T) {} to declare the type of this inside a function body. To swc, this looks like a real paramter. The scope collector was registering it as a binding, causing the compiler to emit an unexpected "reserved word" diagnostic for any hook containing a function with a TS-annotated `this` param. This returns early specifically when the ident name is "this".
wbinnssmith:wbinnssmith/typed-this-react-compiler
3 hours ago
fix(es/minifier): Preserve `cooked` when concatenating template literals (#11939) **Description:** When `compress` folds `a + b` and both sides are template literals, `concat_tpl` merges them into one template literal. Merging the boundary quasis — the last quasi of the left template with the first quasi of the right — updates `raw` but not `cooked`, leaving the merged quasi with `raw` and `cooked` out of sync. Downstream passes (`eval_tpl_as_str`, `eval_nested_tpl`, `compress_tpl`) evaluate the template to a string via `cooked`, so the text after the left template's last interpolation is silently dropped. The result is wrong but not a syntax error, so it ships. Example (`@swc/core` 1.15.41): ```js const { minifySync } = require("@swc/core"); const src = "const html = `<b>${1}</b>` + `<i>${2}</i>`;"; console.log(minifySync(src, { compress: true }).code); ``` Output — the closing `</b>` is dropped: ```js const html = "<b>1<i>2</i>"; // expected: "<b>1</b><i>2</i>" ``` So at runtime the original yields `<b>1</b><i>2</i>`, but the minified code yields `<b>1<i>2</i>`. The dropped text is whatever follows the **left** template's last interpolation: | Source | Expected | Minified | | --- | --- | --- | | `` `<b>${1}</b>` + `<i>${2}</i>` `` | `<b>1</b><i>2</i>` | `<b>1<i>2</i>` | | `` `width:${1}px;` + `height:${2}px;` `` | `width:1px;height:2px;` | `width:1height:2px;` | | `` `(${1})` + ` (${2})` `` | `(1) (2)` | `(1 (2)` | Smallest reproduction: ```js require("@swc/core").minifySync("x = `a${0}]` + `${0}b`", { compress: true }).code // actual: x="a00b"; // expected: x="a0]0b"; ``` The trigger requires **both** template literals to contain an interpolation (`` `a${1}b` + `plain` `` is unaffected, since the right side has none). The sibling branches `Tpl + Str` and `Str + Tpl` already merge `cooked`; only the `Tpl + Tpl` branch was missing it. **Fix:** in the `Tpl + Tpl` branch of `concat_tpl`, merge `cooked` the same way `raw` is merged, falling back to `None` if either side's `cooked` is `None` (an invalid escape sequence). Added an exec regression test that runs the original and the minified code and compares the output. `cargo test -p swc_ecma_minifier` passes (lib: 49, exec: 481, 0 failures). **Related issue (if exists):** None found — this appears to be unreported. It also surfaces through bundlers that wrap swc's JS minifier (e.g. rspack / rsbuild).
main
8 hours ago
fix(es/minifier): Preserve cooked when concatenating template literals
pkasarda:fix-es-minifier-concat-tpl-cooked
8 hours ago
fix(es/minifier): Preserve cooked when concatenating template literals
pkasarda:fix-es-minifier-concat-tpl-cooked
9 hours ago
fix(es/minifier): Preserve cooked when concatenating template literals
pkasarda:fix-es-minifier-concat-tpl-cooked
9 hours ago
chore(types): bump package version
feat/react-compiler
21 hours ago
chore: Add React Compiler changeset
feat/react-compiler
21 hours ago

Latest Branches

CodSpeed Performance Gauge
0%
react-compiler: skip TypeScript this pseudo-params in scope collector#11940
3 hours ago
584e2d3
wbinnssmith:wbinnssmith/typed-this-react-compiler
CodSpeed Performance Gauge
0%
fix(es/minifier): Preserve `cooked` when concatenating template literals#11939
9 hours ago
572d7ca
pkasarda:fix-es-minifier-concat-tpl-cooked
CodSpeed Performance Gauge
0%
21 hours ago
b3b2571
feat/react-compiler
© 2026 CodSpeed Technology
Home Terms Privacy Docs