Skip to content

Commit f55a402

Browse files
committed
fix(docs): set Vite base path for GitHub Pages deployment
Dynamic imports failed on the deployed Storybook because assets were served from the root instead of the /react-zoom-pan-pinch/ subdirectory. Configure the Vite base via STORYBOOK_BASE env var so the production build emits correct asset paths. Made-with: Cursor
1 parent e9c2100 commit f55a402

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const config: StorybookConfig = {
1818
autodocs: "tag",
1919
},
2020
async viteFinal(config) {
21-
// return the customized config
2221
return mergeConfig(config, {
22+
base: process.env.STORYBOOK_BASE || "/",
2323
plugins: [
2424
tsconfigPaths(),
2525
svgr({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"scripts": {
1818
"build": "rollup -c",
19-
"build:docs": "storybook build",
19+
"build:docs": "STORYBOOK_BASE=/react-zoom-pan-pinch/ storybook build",
2020
"start": "cross-env DISABLE_ESLINT_PLUGIN=true yarn storybook dev -p 6006",
2121
"test": "jest",
2222
"test:debug": "jest-preview",

0 commit comments

Comments
 (0)