Skip to content

Commit 9db31d8

Browse files
committed
chore: adapt babel config to v8
Remove deprecated `useSpread` option (always-on in Babel 8) and scope `@babel/preset-react` to `.tsx` files only via overrides. Babel 8's `@babel/preset-typescript` no longer passes `isTSX: false` for `.ts` files, so preset-react's globally-added JSX transform would otherwise make the parser treat TypeScript generic syntax like `<T = ...>` as JSX and fail to compile.
1 parent 8f3ed1a commit 9db31d8

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

packages/main/.babelrc.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@
77
"browserslistEnv": "production"
88
}
99
],
10-
[
11-
"@babel/preset-react",
12-
{
13-
"runtime": "automatic",
14-
"useSpread": true
15-
}
16-
],
1710
"@babel/preset-typescript"
1811
],
12+
"overrides": [
13+
{
14+
"test": "**/*.tsx",
15+
"presets": [
16+
[
17+
"@babel/preset-react",
18+
{
19+
"runtime": "automatic"
20+
}
21+
]
22+
]
23+
}
24+
],
1925
"env": {
2026
"ssr": {
2127
"plugins": [

0 commit comments

Comments
 (0)