Skip to content

Commit 8d7609e

Browse files
committed
fix: add Babel compiler addon and React 18 devDep for Storybook v10
Storybook v8+ removed Babel from the default webpack5 build — it must be opted in via @storybook/addon-webpack5-compiler-babel. Without it, webpack has no TypeScript transpiler and .ts/.tsx files fail to parse (the Netlify CI failure). Also bumps react/react-dom devDependencies to ^18.2.0 and @types/react* to ^18 — Storybook v10 internally uses useSyncExternalStore and useInsertionEffect which were added in React 18. Note: peerDependencies stay at >=17 — consumers are unaffected.
1 parent 2a526cd commit 8d7609e

3 files changed

Lines changed: 50 additions & 38 deletions

File tree

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const config: StorybookConfig = {
55
'../src/**/*.stories.@(js|jsx|ts|tsx)',
66
'../src/stories/stories.tsx',
77
],
8-
addons: ['@storybook/addon-docs'],
8+
addons: ['@storybook/addon-docs', '@storybook/addon-webpack5-compiler-babel'],
99
framework: {
1010
name: '@storybook/react-webpack5',
1111
options: {},

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,37 +52,38 @@
5252
"@babel/preset-env": "^7.28.5",
5353
"@babel/preset-react": "^7.28.5",
5454
"@babel/preset-typescript": "^7.28.5",
55+
"@rollup/plugin-node-resolve": "^15.0.0",
56+
"@rollup/plugin-typescript": "^11.0.0",
5557
"@size-limit/preset-small-lib": "^12.0.1",
58+
"@storybook/addon-docs": "^10.3.5",
59+
"@storybook/addon-webpack5-compiler-babel": "^4.0.1",
5660
"@storybook/react": "^10.3.5",
5761
"@storybook/react-webpack5": "^10.3.5",
5862
"@testing-library/react": "^12.1.5",
5963
"@types/jest": "^29.5.14",
60-
"@types/react": "^17.0.0",
61-
"@types/react-dom": "^17.0.0",
64+
"@types/react": "^18.0.0",
65+
"@types/react-dom": "^18.0.0",
6266
"@types/throttle-debounce": "^2.1.0",
6367
"@typescript-eslint/eslint-plugin": "^8.50.1",
6468
"@typescript-eslint/parser": "^8.50.1",
6569
"babel-loader": "^8.0.6",
6670
"eslint": "^8",
6771
"eslint-config-prettier": "^10.1.8",
6872
"eslint-plugin-react": "^7.37.5",
73+
"eslint-plugin-storybook": "10.3.5",
6974
"husky": "^9.0.0",
7075
"jest": "^29.7.0",
7176
"jest-environment-jsdom": "^29.7.0",
7277
"lint-staged": "^15.0.0",
7378
"prettier": "^2.8.0",
74-
"react": "^17.0.2",
75-
"react-dom": "^17.0.2",
76-
"@rollup/plugin-node-resolve": "^15.0.0",
77-
"@rollup/plugin-typescript": "^11.0.0",
79+
"react": "^18.2.0",
80+
"react-dom": "^18.2.0",
7881
"rimraf": "^5.0.0",
7982
"rollup": "^4.0.0",
8083
"size-limit": "^12.0.1",
8184
"storybook": "^10.3.5",
8285
"ts-jest": "^29.4.6",
83-
"typescript": "^4.9.0",
84-
"eslint-plugin-storybook": "10.3.5",
85-
"@storybook/addon-docs": "^10.3.5"
86+
"typescript": "^4.9.0"
8687
},
8788
"dependencies": {
8889
"throttle-debounce": "^2.1.0"

yarn.lock

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
json5 "^2.2.3"
5757
semver "^6.3.1"
5858

59-
"@babel/core@^7.28.0":
59+
"@babel/core@^7.26.0", "@babel/core@^7.28.0":
6060
version "7.29.0"
6161
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.29.0.tgz#5286ad785df7f79d656e88ce86e650d16ca5f322"
6262
integrity sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==
@@ -1787,6 +1787,14 @@
17871787
react-dom "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
17881788
ts-dedent "^2.0.0"
17891789

1790+
"@storybook/addon-webpack5-compiler-babel@^4.0.1":
1791+
version "4.0.1"
1792+
resolved "https://registry.yarnpkg.com/@storybook/addon-webpack5-compiler-babel/-/addon-webpack5-compiler-babel-4.0.1.tgz#6306df1b09cd913a998ff49900c89dfbd66cfb2d"
1793+
integrity sha512-1oTh6264hFGl40D5YCPhnpuirXeBSNo+7L8MZ4pKMLRLOsnK8CKC3Yp4L+tGySsJFsem8RXau8eZAQskf2Re/g==
1794+
dependencies:
1795+
"@babel/core" "^7.26.0"
1796+
babel-loader "^10.0.0"
1797+
17901798
"@storybook/builder-webpack5@10.3.5":
17911799
version "10.3.5"
17921800
resolved "https://registry.yarnpkg.com/@storybook/builder-webpack5/-/builder-webpack5-10.3.5.tgz#e1370f60b5397dd780eb3301695e136ed77a1ee9"
@@ -2076,18 +2084,22 @@
20762084
resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz"
20772085
integrity sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==
20782086

2079-
"@types/react-dom@<18.0.0", "@types/react-dom@^17.0.0":
2087+
"@types/react-dom@<18.0.0":
20802088
version "17.0.26"
20812089
resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.26.tgz"
20822090
integrity sha512-Z+2VcYXJwOqQ79HreLU/1fyQ88eXSSFh6I3JdrEHQIfYSI0kCQpTGvOrbE6jFGGYXKsHuwY9tBa/w5Uo6KzrEg==
20832091

2084-
"@types/react@^17.0.0":
2085-
version "17.0.90"
2086-
resolved "https://registry.npmjs.org/@types/react/-/react-17.0.90.tgz"
2087-
integrity sha512-P9beVR/x06U9rCJzSxtENnOr4BrbJ6VrsrDTc+73TtHv9XHhryXKbjGRB+6oooB2r0G/pQkD/S4dHo/7jUfwFw==
2092+
"@types/react-dom@^18.0.0":
2093+
version "18.3.7"
2094+
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.7.tgz#b89ddf2cd83b4feafcc4e2ea41afdfb95a0d194f"
2095+
integrity sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==
2096+
2097+
"@types/react@^18.0.0":
2098+
version "18.3.28"
2099+
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.28.tgz#0a85b1a7243b4258d9f626f43797ba18eb5f8781"
2100+
integrity sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==
20882101
dependencies:
20892102
"@types/prop-types" "*"
2090-
"@types/scheduler" "^0.16"
20912103
csstype "^3.2.2"
20922104

20932105
"@types/resolve@1.20.2":
@@ -2100,11 +2112,6 @@
21002112
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.6.tgz#e6e60dad29c2c8c206c026e6dd8d6d1bdda850b8"
21012113
integrity sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==
21022114

2103-
"@types/scheduler@^0.16":
2104-
version "0.16.8"
2105-
resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz"
2106-
integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==
2107-
21082115
"@types/semver@^7.7.1":
21092116
version "7.7.1"
21102117
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.7.1.tgz#3ce3af1a5524ef327d2da9e4fd8b6d95c8d70528"
@@ -2747,6 +2754,13 @@ babel-jest@^29.7.0:
27472754
graceful-fs "^4.2.9"
27482755
slash "^3.0.0"
27492756

2757+
babel-loader@^10.0.0:
2758+
version "10.1.1"
2759+
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-10.1.1.tgz#ce9748e85b7071eb88006e3cfa9e6cf14eeb97c5"
2760+
integrity sha512-JwKSzk2kjIe7mgPK+/lyZ2QAaJcpahNAdM+hgR2HI8D0OJVkdj8Rl6J3kaLYki9pwF7P2iWnD8qVv80Lq1ABtg==
2761+
dependencies:
2762+
find-up "^5.0.0"
2763+
27502764
babel-loader@^8.0.6:
27512765
version "8.4.1"
27522766
resolved "https://registry.npmjs.org/babel-loader/-/babel-loader-8.4.1.tgz"
@@ -6161,14 +6175,13 @@ react-docgen@^8.0.2:
61616175
dependencies:
61626176
scheduler "^0.27.0"
61636177

6164-
react-dom@^17.0.2:
6165-
version "17.0.2"
6166-
resolved "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz"
6167-
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
6178+
react-dom@^18.2.0:
6179+
version "18.3.1"
6180+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4"
6181+
integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==
61686182
dependencies:
61696183
loose-envify "^1.1.0"
6170-
object-assign "^4.1.1"
6171-
scheduler "^0.20.2"
6184+
scheduler "^0.23.2"
61726185

61736186
react-is@^16.13.1:
61746187
version "16.13.1"
@@ -6190,13 +6203,12 @@ react-is@^18.0.0:
61906203
resolved "https://registry.yarnpkg.com/react/-/react-19.2.5.tgz#c888ab8b8ef33e2597fae8bdb2d77edbdb42858b"
61916204
integrity sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA==
61926205

6193-
react@^17.0.2:
6194-
version "17.0.2"
6195-
resolved "https://registry.npmjs.org/react/-/react-17.0.2.tgz"
6196-
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
6206+
react@^18.2.0:
6207+
version "18.3.1"
6208+
resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
6209+
integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
61976210
dependencies:
61986211
loose-envify "^1.1.0"
6199-
object-assign "^4.1.1"
62006212

62016213
readdirp@^4.0.1:
62026214
version "4.1.2"
@@ -6473,13 +6485,12 @@ saxes@^6.0.0:
64736485
dependencies:
64746486
xmlchars "^2.2.0"
64756487

6476-
scheduler@^0.20.2:
6477-
version "0.20.2"
6478-
resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz"
6479-
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
6488+
scheduler@^0.23.2:
6489+
version "0.23.2"
6490+
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3"
6491+
integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==
64806492
dependencies:
64816493
loose-envify "^1.1.0"
6482-
object-assign "^4.1.1"
64836494

64846495
scheduler@^0.27.0:
64856496
version "0.27.0"

0 commit comments

Comments
 (0)