How to change storybook base URL

677 views Asked by At

does anyone know how to set up a different base URL for storybook? when you run "npm run storybook" it opens up on http://localhost:6006/, how can i get it to open up on http://localhost:6006/storybook/?

3

There are 3 answers

0
Nikhil K Mannem On

Long story short, it's not compatible with the ports' convention(s). The ports that host the running of your application(s) are reserved for one app at a time, and they take the route(s) from application's router rather than opening it up on a custom base like http://localhost:6006/storybook/?.

0
D3strukt0r On

If you are using Vite.js, you can set base: '/storybook/', in the viteFinal function of the .storybook/main.{js|ts} file

0
Marek Vajda On

This doesn't work as storybook use express.js for the dev server. See the issue here: github issue Something like this should be added here github link, but probably not possible now ...

app.use('/baseUrl', router);