Skip to content

Commit

Permalink
feat(storybook): set dynamic base path for deployment
Browse files Browse the repository at this point in the history
- Added `STORYBOOK_BASE_URL="/ris-ui"` in GitHub Actions.
- Updated `viteFinal` to set `config.base` dynamically.
- Ensured `fonts.css` works in both local and deployed environments.

RISDEV-0000
  • Loading branch information
hamo225 committed Feb 4, 2025
1 parent 1e27b9c commit ddf4de8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ jobs:
group: "pages"
cancel-in-progress: true
runs-on: ubuntu-latest
env:
STORYBOOK_BASE_URL: "/ris-ui"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const config: StorybookConfig = {

async viteFinal(config) {
if (!config.plugins) config.plugins = [];

// Dynamically set base path for Storybook
config.base = process.env.STORYBOOK_BASE_URL || "/";

config.plugins.push(Icons({ autoInstall: true }));
return config;
},
Expand Down

0 comments on commit ddf4de8

Please sign in to comment.