Skip to content

Commit cd1ddcd

Browse files
authored
chore: clean up Storybook configuration
1 parent da84ffa commit cd1ddcd

5 files changed

Lines changed: 102 additions & 66 deletions

File tree

.storybook/main.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import type { StorybookConfig } from '@storybook/react-webpack5';
2+
import type { Configuration } from 'webpack';
3+
4+
const config: StorybookConfig = {
5+
stories: ['../src/**/*.stories.tsx'],
6+
addons: ['@storybook/addon-docs', '@storybook/addon-webpack5-compiler-babel'],
7+
framework: {
8+
name: '@storybook/react-webpack5',
9+
options: {
10+
fastRefresh: true,
11+
strictMode: true,
12+
},
13+
},
14+
webpackFinal: (webpackConfig: Configuration) => {
15+
webpackConfig.module!.rules!.push({
16+
test: /\.less$/,
17+
use: [
18+
'style-loader',
19+
'css-loader',
20+
{
21+
loader: 'less-loader',
22+
options: {
23+
lessOptions: {
24+
javascriptEnabled: true,
25+
},
26+
},
27+
},
28+
],
29+
});
30+
31+
// Suppress warnings about TypeScript type-only re-exports
32+
// These are harmless - types are stripped during compilation, but webpack still tries to verify them
33+
webpackConfig.ignoreWarnings = [
34+
/export .* \(reexported as .*\) was not found/,
35+
];
36+
37+
return webpackConfig;
38+
},
39+
};
40+
41+
export default config;

babel.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
module.exports = {
2-
presets: ['@babel/preset-env', '@babel/preset-react'],
2+
presets: [
3+
'@babel/preset-env',
4+
'@babel/preset-react',
5+
'@babel/preset-typescript',
6+
],
37
plugins: [
48
'babel-plugin-styled-components',
59
'@babel/plugin-transform-runtime',

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"@babel/plugin-transform-runtime": "^7.26.10",
6969
"@babel/preset-env": "^7.26.10",
7070
"@babel/preset-react": "^7.26.10",
71+
"@babel/preset-typescript": "^7.28.5",
7172
"@babel/runtime": "^7.26.10",
7273
"@mll-lab/eslint-config": "^3.1.0",
7374
"@mll-lab/eslint-plugin": "^1.3.4",
@@ -80,6 +81,7 @@
8081
"@semantic-release/changelog": "^6.0.3",
8182
"@semantic-release/git": "^10.0.1",
8283
"@storybook/addon-docs": "^10.0.5",
84+
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
8385
"@storybook/react-webpack5": "^10.0.5",
8486
"@testing-library/dom": "^9.3.3",
8587
"@testing-library/jest-dom": "^6.6.4",

yarn.lock

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ __metadata:
159159
languageName: node
160160
linkType: hard
161161

162-
"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.18.9, @babel/core@npm:^7.26.10":
162+
"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.18.9, @babel/core@npm:^7.26.0, @babel/core@npm:^7.26.10":
163163
version: 7.28.5
164164
resolution: "@babel/core@npm:7.28.5"
165165
dependencies:
@@ -231,7 +231,7 @@ __metadata:
231231
languageName: node
232232
linkType: hard
233233

234-
"@babel/helper-create-class-features-plugin@npm:^7.27.1, @babel/helper-create-class-features-plugin@npm:^7.28.3":
234+
"@babel/helper-create-class-features-plugin@npm:^7.27.1, @babel/helper-create-class-features-plugin@npm:^7.28.3, @babel/helper-create-class-features-plugin@npm:^7.28.5":
235235
version: 7.28.5
236236
resolution: "@babel/helper-create-class-features-plugin@npm:7.28.5"
237237
dependencies:
@@ -325,7 +325,7 @@ __metadata:
325325
languageName: node
326326
linkType: hard
327327

328-
"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.27.1, @babel/helper-plugin-utils@npm:^7.8.0":
328+
"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.27.1, @babel/helper-plugin-utils@npm:^7.8.0":
329329
version: 7.27.1
330330
resolution: "@babel/helper-plugin-utils@npm:7.27.1"
331331
checksum: 10c0/94cf22c81a0c11a09b197b41ab488d416ff62254ce13c57e62912c85700dc2e99e555225787a4099ff6bae7a1812d622c80fbaeda824b79baa10a6c5ac4cf69b
@@ -654,14 +654,14 @@ __metadata:
654654
languageName: node
655655
linkType: hard
656656

657-
"@babel/plugin-syntax-typescript@npm:^7.7.2":
658-
version: 7.23.3
659-
resolution: "@babel/plugin-syntax-typescript@npm:7.23.3"
657+
"@babel/plugin-syntax-typescript@npm:^7.27.1, @babel/plugin-syntax-typescript@npm:^7.7.2":
658+
version: 7.27.1
659+
resolution: "@babel/plugin-syntax-typescript@npm:7.27.1"
660660
dependencies:
661-
"@babel/helper-plugin-utils": "npm:^7.22.5"
661+
"@babel/helper-plugin-utils": "npm:^7.27.1"
662662
peerDependencies:
663663
"@babel/core": ^7.0.0-0
664-
checksum: 10c0/4d6e9cdb9d0bfb9bd9b220fc951d937fce2ca69135ec121153572cebe81d86abc9a489208d6b69ee5f10cadcaeffa10d0425340a5029e40e14a6025021b90948
664+
checksum: 10c0/11589b4c89c66ef02d57bf56c6246267851ec0c361f58929327dc3e070b0dab644be625bbe7fb4c4df30c3634bfdfe31244e1f517be397d2def1487dbbe3c37d
665665
languageName: node
666666
linkType: hard
667667

@@ -1296,6 +1296,21 @@ __metadata:
12961296
languageName: node
12971297
linkType: hard
12981298

1299+
"@babel/plugin-transform-typescript@npm:^7.28.5":
1300+
version: 7.28.5
1301+
resolution: "@babel/plugin-transform-typescript@npm:7.28.5"
1302+
dependencies:
1303+
"@babel/helper-annotate-as-pure": "npm:^7.27.3"
1304+
"@babel/helper-create-class-features-plugin": "npm:^7.28.5"
1305+
"@babel/helper-plugin-utils": "npm:^7.27.1"
1306+
"@babel/helper-skip-transparent-expression-wrappers": "npm:^7.27.1"
1307+
"@babel/plugin-syntax-typescript": "npm:^7.27.1"
1308+
peerDependencies:
1309+
"@babel/core": ^7.0.0-0
1310+
checksum: 10c0/09e574ba5462e56452b4ceecae65e53c8e697a2d3559ce5d210bed10ac28a18aa69377e7550c30520eb29b40c417ee61997d5d58112657f22983244b78915a7c
1311+
languageName: node
1312+
linkType: hard
1313+
12991314
"@babel/plugin-transform-unicode-escapes@npm:^7.27.1":
13001315
version: 7.27.1
13011316
resolution: "@babel/plugin-transform-unicode-escapes@npm:7.27.1"
@@ -1452,6 +1467,21 @@ __metadata:
14521467
languageName: node
14531468
linkType: hard
14541469

1470+
"@babel/preset-typescript@npm:^7.28.5":
1471+
version: 7.28.5
1472+
resolution: "@babel/preset-typescript@npm:7.28.5"
1473+
dependencies:
1474+
"@babel/helper-plugin-utils": "npm:^7.27.1"
1475+
"@babel/helper-validator-option": "npm:^7.27.1"
1476+
"@babel/plugin-syntax-jsx": "npm:^7.27.1"
1477+
"@babel/plugin-transform-modules-commonjs": "npm:^7.27.1"
1478+
"@babel/plugin-transform-typescript": "npm:^7.28.5"
1479+
peerDependencies:
1480+
"@babel/core": ^7.0.0-0
1481+
checksum: 10c0/b3d55548854c105085dd80f638147aa8295bc186d70492289242d6c857cb03a6c61ec15186440ea10ed4a71cdde7d495f5eb3feda46273f36b0ac926e8409629
1482+
languageName: node
1483+
linkType: hard
1484+
14551485
"@babel/runtime@npm:^7.10.1, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.10.4, @babel/runtime@npm:^7.11.1, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.18.0, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.0, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.26.10":
14561486
version: 7.28.4
14571487
resolution: "@babel/runtime@npm:7.28.4"
@@ -2412,6 +2442,7 @@ __metadata:
24122442
"@babel/plugin-transform-runtime": "npm:^7.26.10"
24132443
"@babel/preset-env": "npm:^7.26.10"
24142444
"@babel/preset-react": "npm:^7.26.10"
2445+
"@babel/preset-typescript": "npm:^7.28.5"
24152446
"@babel/runtime": "npm:^7.26.10"
24162447
"@dnd-kit/core": "npm:^6.0.8"
24172448
"@mll-lab/eslint-config": "npm:^3.1.0"
@@ -2426,6 +2457,7 @@ __metadata:
24262457
"@semantic-release/changelog": "npm:^6.0.3"
24272458
"@semantic-release/git": "npm:^10.0.1"
24282459
"@storybook/addon-docs": "npm:^10.0.5"
2460+
"@storybook/addon-webpack5-compiler-babel": "npm:^3.0.6"
24292461
"@storybook/react-webpack5": "npm:^10.0.5"
24302462
"@testing-library/dom": "npm:^9.3.3"
24312463
"@testing-library/jest-dom": "npm:^6.6.4"
@@ -3509,6 +3541,16 @@ __metadata:
35093541
languageName: node
35103542
linkType: hard
35113543

3544+
"@storybook/addon-webpack5-compiler-babel@npm:^3.0.6":
3545+
version: 3.0.6
3546+
resolution: "@storybook/addon-webpack5-compiler-babel@npm:3.0.6"
3547+
dependencies:
3548+
"@babel/core": "npm:^7.26.0"
3549+
babel-loader: "npm:^9.2.1"
3550+
checksum: 10c0/c423fbc7290a4d3961f4e4a13b2832b3762f120414fd7cfd06fe0d8ccf9e66328a21af135054ff5dbf2e08faefe4492fbc44c2ae7731911c164f185358b84e0a
3551+
languageName: node
3552+
linkType: hard
3553+
35123554
"@storybook/builder-webpack5@npm:10.0.5":
35133555
version: 10.0.5
35143556
resolution: "@storybook/builder-webpack5@npm:10.0.5"
@@ -5183,16 +5225,16 @@ __metadata:
51835225
languageName: node
51845226
linkType: hard
51855227

5186-
"babel-loader@npm:^9.1.3":
5187-
version: 9.1.3
5188-
resolution: "babel-loader@npm:9.1.3"
5228+
"babel-loader@npm:^9.1.3, babel-loader@npm:^9.2.1":
5229+
version: 9.2.1
5230+
resolution: "babel-loader@npm:9.2.1"
51895231
dependencies:
51905232
find-cache-dir: "npm:^4.0.0"
51915233
schema-utils: "npm:^4.0.0"
51925234
peerDependencies:
51935235
"@babel/core": ^7.12.0
51945236
webpack: ">=5"
5195-
checksum: 10c0/e3fc3c9e02bd908b37e8e8cd4f3d7280cf6ac45e33fc203aedbb615135a0fecc33bf92573b71a166a827af029d302c0b060354985cd91d510320bd70a2f949eb
5237+
checksum: 10c0/efb82faff4c7c27e9c15bb28bf11c73200e61cf365118a9514e8d74dd489d0afc2a0d5aaa62cb4254eefc2ab631579224d95a03fd245410f28ea75e24de54ba4
51965238
languageName: node
51975239
linkType: hard
51985240

0 commit comments

Comments
 (0)