Skip to content

Commit c44b1f0

Browse files
Exclude stories from the published build
They were compiled into dist despite not being exported, dragging their base64-js import in as a runtime dependency; it is now dev-only. The build uses a new tsconfig.build.json while tsconfig.json still covers everything for the editor and the new typecheck script in ci, so the stories remain typechecked (Storybook's own build only transpiles).
1 parent a250e4c commit c44b1f0

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

package-lock.json

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@
5757
},
5858
"scripts": {
5959
"dev": "vite",
60-
"build:esm": "tsc -p tsconfig.json && echo '{\"type\": \"module\"}' > dist/esm/package.json",
60+
"build:esm": "tsc -p tsconfig.build.json && echo '{\"type\": \"module\"}' > dist/esm/package.json",
6161
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
6262
"build": "npm run build:esm && npm run build:cjs",
63+
"typecheck": "tsc -p tsconfig.json --noEmit",
6364
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
64-
"ci": "npm run lint && npm run build && npm run build:storybook",
65+
"ci": "npm run lint && npm run typecheck && npm run build && npm run build:storybook",
6566
"storybook": "storybook dev -p 6006",
6667
"build:storybook": "storybook build",
6768
"docs": "typedoc"
@@ -70,11 +71,9 @@
7071
"react": ">=18.0.0",
7172
"react-dom": ">=18.0.0"
7273
},
73-
"dependencies": {
74-
"base64-js": "^1.5.1"
75-
},
7674
"devDependencies": {
7775
"@chromatic-com/storybook": "^1.2.25",
76+
"base64-js": "^1.5.1",
7877
"@storybook/addon-essentials": "^8.0.5",
7978
"@storybook/addon-interactions": "^8.0.5",
8079
"@storybook/addon-links": "^8.0.5",

tsconfig.build.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": ["src/stories"]
4+
}

tsconfig.cjs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "./tsconfig.json",
2+
"extends": "./tsconfig.build.json",
33
"compilerOptions": {
44
"module": "CommonJS",
55
"moduleResolution": "Node",

0 commit comments

Comments
 (0)