-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Does not work with @vitejs/plugin-react-swc #551
Comments
OK good point, I didn't consider In the meantime, have you considered upgrading to storybook 7? It will use your vite.config file automatically, and does not use webpack for the manager. You can try upgrading with Of if you'd like to submit a PR to allow builder-vite/packages/builder-vite/vite-config.ts Lines 210 to 221 in ed9cc3d
|
Hi @IanVS! Do you need me to change anything on the plugin side? |
Nope, but thanks @ArnaudBarre! I just need to remember that it exists, that's all. 🤦 |
Fixes #551 This will first look for `@vitejs/plugin-react`, then `@vitejs/plugin-react-swc`. It seems like the SWC version might not work with MDX stories, though. I updated the react-18 example to use it, and the intro story doesn't load. I don't think that should necessarily block this PR though. * Allow the use of @vitejs/plugin-react-swc * Use react-plugin-swc in react-18 example * Fix NODE_PATH in all examples * Fix peer dependencies * Fix update-examples script
Released in 0.4.1 |
What version of
vite
are you using?4.0.4
System info and storybook versions
Environment Info:
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.10.0/bin/yarn
npm: 7.24.0 - ~/.nvm/versions/node/v16.10.0/bin/npm
Browsers:
Chrome: 109.0.5414.119
Firefox: 109.0
Safari: 16.2
npmPackages:
@storybook/addon-actions: 6.5.16 => 6.5.16
@storybook/addon-essentials: 6.5.16 => 6.5.16
@storybook/addon-interactions: 6.5.16 => 6.5.16
@storybook/addon-links: 6.5.16 => 6.5.16
@storybook/builder-vite: 0.4.0 => 0.4.0
@storybook/react: 6.5.16 => 6.5.16
@storybook/testing-library: 0.0.13 => 0.0.13
Describe the Bug
Good morning, with version 0.3.0, it worked fine for me, until I tried to introduce the svgr library,
https://react-svgr.com/ in the vite project with the following configuration it works, I mean the package.json and vite.config.js configuration that I show you.
What's special about me, because I'm using swc @vitejs/plugin-react-swc to make it work much faster. So for it to work I have tried to use the vite configuration vite.config.js, not the storybook one because if not, I have to use webpack to configure svgr and I want to use storybook with vite. so I tried to use the configuration to be able to use the vite project configuration but the resolve returns me undefined and it doesn't work of course, I did many tests with that part and nothing.
resolve: (await import('../vite.config.js')).default.resolve,
This morning Spanish time I have seen a new update that you released last night, the 0.4.0, I update it and directly without svgr it does not work for me, it must be in conflict with @vitejs/plugin-react-swc, this error gives
" @storybook/builder-vite requires @vitejs/plugin-react to be installed when using @storybook/react."
package.json
vite.config.js
Link to Minimal Reproducible Example
No response
Participation
The text was updated successfully, but these errors were encountered: