This is a weird one. I've figured out a workaround, but this is different behavior than SB4.
Describe the bug
I have @storybook/html, @storybook/react, and @storybook/vue installed and they use their own config files that I point to.
To Reproduce
Here are my npm scripts
"storybook:html": "cross-env NODE_PATH=styles:components start-storybook -s ./vendor -p 9005 -c .storybook/html",
"storybook:vue": "cross-env NODE_PATH=styles:components start-storybook -p 9006 -c .storybook/vue",
"storybook:react": "cross-env NODE_PATH=styles:components start-storybook -p 9007 -c .storybook/react",
When I run storybook:react, in termial, I get this:
> cross-env NODE_PATH=styles:components start-storybook -p 9007 -c .storybook/react
info @storybook/vue v5.0.6
````
**Expected behavior**
I would expect `@storybook/react` to firing things up. I tried removing `@storybook/vue` and then when I ran `npm run storybook:react`, it fires up with `@storybook/html`!
My hunch is, `start-storybook`'s behavior has changed. If I run `npx start-storybook` or `npx start-storybook -c .storybook/react`, it runs `@storybook/vue` still, despite me pointing to a React config file.
I would expect `start-storybook` to simply find the config and infer the Storybook type from the imports.
Maybe multi-framework support wasn't in mind in this fashion (I know it is on the road map except as a single Storybook), but they share style and image assets. It worked out fine in SB4.
Here's my workaround. I just point straight the desired bin:
"storybook:html": "cross-env NODE_PATH=styles:components node_modules/@storybook/html/bin/index.js -s ./vendor -p 9005 -c .storybook/html",
"storybook:vue": "cross-env NODE_PATH=styles:components node_modules/@storybook/vue/bin/index.js -p 9006 -c .storybook/vue",
"storybook:react": "cross-env NODE_PATH=styles:components node_modules/@storybook/react/bin/index.js -p 9007 -c .storybook/react",
```
System:
Hi @tarikhamilton I'm not sure how this actually would've worked in 4.x -- I wouldn't expect it to. Your workaround looks good to me and is what I would do. I'll leave this open in case somebody else wants to chime in, since it's possible that something broke in the v5 release.
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!
@tarikhamilton I've faced the same problem and tried to use your approach.
I ran npx -p @storybook/cli sb init, my env was initialised for vue.js, after I added configs for React and HTML but @storybook/vue was used. The same as yours.
After I installed @storybook/cli as a dependency but _didn't initialise it._
And added
"storybook:js": "node_modules/@storybook/html/bin/index.js -s ./public -p 9005 -c config/js",
"storybook:vue": "node_modules/@storybook/vue/bin/index.js -s ./public -p 9006 -c config/vue"
to my package.json file
It takes the appropriate config file and works!
So it can be a trick for those who want to use storybook for multiple framework
Hope it helps.
I'd like to see this feature working
Most helpful comment
@tarikhamilton I've faced the same problem and tried to use your approach.
I ran
npx -p @storybook/cli sb init, my env was initialised for vue.js, after I added configs for React and HTML but @storybook/vue was used. The same as yours.After I installed @storybook/cli as a dependency but _didn't initialise it._
And added
to my package.json file
It takes the appropriate config file and works!
So it can be a trick for those who want to use storybook for multiple framework
Hope it helps.