-
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
Allow configuring React plugin #113
Comments
Hi, it's a little bit tricky, because of the way that |
Here's an example that I'm using in my own project. It's a little hacky, but it does work.
|
My even more hacky workaround
...
async viteFinal(config, { configType }) {
config.base = "";
config.plugins.splice(4, 1);
config.plugins.push(
require("@vitejs/plugin-react")({
exclude: [/\.stories\.(t|j)sx?$/, /node_modules/],
babel: {
parserOpts: {
plugins: ["decorators-legacy"],
},
},
})
);
return config;
},
... |
@IanVS your solution worked for me. Was fighting that one for a while. I needed to have
Looks like its directly using some plugins but some of those are now deprecated in favor of the |
While these solutions work, they are duplicating some logic that is in |
@gustavohenke do you have a suggestion of how we could accomplish it? I'm certainly open to ideas. |
uhh storybook docs is a bit difficult to navigate/poor when you want to find information about the Are you able to read anything from the configuration file, or maybe just from the If yes, then that's definitely the place to read from, I wouldn't expect this package having knowledge of the separate vite config. |
This can be closed i think See #286 |
I'll leave it open for now, but this is fixed in Storybook 7.0, where your project's vite.config file is used automatically instead of storybook itself injecting the vite plugin. |
I am using Storybook 7.0 and it's not working i have styled-components |
This repo is for Storybook 6.5. As I mentioned in the other issue you commented on, please open a new issue with all the details, so someone can look into it. Closing this issue as wontfix for 6.5 |
👋 been upgrading my packages today, and noticed that with Vite moving away from
plugin-react-refresh
and suggesting the use ofplugin-react
, one of the features I use in my codebase is not supported anymore: decorators.plugin-react
docs shows an example on how to enable it:https://github.com/vitejs/vite/blob/b17444fd97b02bc54410c8575e7d3cb25e4058c2/packages/plugin-react/README.md#L54-L66
With the above said, my ask is: can we please have a way to configure the plugin?
I'm not sure if
viteFinal()
works for this already, but judging from Vite's plugin API, I'd say no.Also adding the
plugin-react
twice to the config from there doesn't sound good.thanks in advance!
The text was updated successfully, but these errors were encountered: