Closed rlesniak closed 2 years ago
When you say I have configured Vite
, do you mean in your vite.config.js
? Have you made the same changes in your viteFinal
of .storybook/main.js
?
Yes, I mean vite.config.ts
Yes, viteFinal is merged config
core: {
builder: '@storybook/builder-vite',
},
async viteFinal(config, { configType }) {
const { config: userConfig } = await loadConfigFromFile(
path.resolve(__dirname, '../vite.config.ts'),
);
// Keep storybook plugins in storybookPlugins
const storybookPlugins = config.plugins;
config.plugins = [];
return mergeConfig(config, {
...userConfig,
plugins: [
// Replace @vitejs/plugin-react from storybook by ours
...storybookPlugins.filter(
(plugin) =>
!(
Array.isArray(plugin) &&
plugin[0].name === 'vite:react-babel'
),
),
react({
// Copied from https://github.com/eirslett/storybook-builder-vite/blob/917d8868943ec5f58c9c2c6900e196637f0d05e3/packages/storybook-builder-vite/vite-config.ts#L95
// Do not treat story files as HMR boundaries, storybook itself needs to handle them.
exclude: [/\.stories\.([tj])sx?$/, /node_modules/],
}),
svgrPlugin(),
],
});
},```
Thanks for pointing this out, and for doing the work to find the cause!
This is fixed in 0.1.39.
Thank you very much 🙂
What version of
vite
are you using?2.9.13
System info and storybook versions
Describe the Bug
I found regression in 0.1.37, perhaps in this line
I have configured Vite to have
resolve.alias
as array, so ie.And because of that i cant run storybook because many errors like
Last version without this issue is 0.1.36. I am on React 17
Please add support for arrays as well
Link to Minimal Reproducible Example
No response
Participation