Closed tastafur closed 1 year ago
OK good point, I didn't consider @vitejs/plugin-react-swc
, we can make some changes there.
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 npx sb@next upgrade --prerelease
.
Of if you'd like to submit a PR to allow @vitejs/plugin-react-swc
, the logic is here: https://github.com/storybookjs/builder-vite/blob/ed9cc3df1cef4ae894fa3b56adc2c7ea81df3628/packages/builder-vite/vite-config.ts#L210-L221.
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. 🤦
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