[Bug] Storybook addons don't work after migrating to vite
See original GitHub issueDescribe the bug
I’ve been trying migrating storybook to vite, but when it start, storybook addons don’t seem to work
Steps to reproduce the behavior
Here is my example config in main.js
:
var path = require('path');
const { mergeConfig } = require('vite')
module.exports = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
'@storybook/addon-docs',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-storysource',
'@storybook/addon-a11y',
'@storybook/addon-controls',
'storybook-addon-jsx'
],
framework: "@storybook/react",
core: {
builder: '@storybook/builder-vite'
},
async viteFinal(config) {
return mergeConfig(config, {
optimizeDeps: {
include: [
'@storybook/addon-docs/blocks',
'@storybook/addon-docs/dist/esm/frameworks/common/config.js',
'@storybook/addon-docs/dist/esm/frameworks/react/config.js',
'@storybook/react/dist/esm/client/preview/config',
'@storybook/addon-links/dist/esm/preset/addDecorator.js',
'@storybook/addon-actions/dist/esm/preset/addDecorator.js',
'@storybook/addon-actions/dist/esm/preset/addArgs.js',
'@storybook/addon-backgrounds/dist/esm/preset/addDecorator.js',
'@storybook/addon-backgrounds/dist/esm/preset/addParameter.js',
'@storybook/addon-measure/dist/esm/preset/addDecorator.js',
'@storybook/addon-outline/dist/esm/preset/addDecorator.js',
'@storybook/addon-a11y/dist/esm/a11yRunner.js',
'@storybook/addon-a11y/dist/esm/a11yHighlight.js',
'antd',
'styled-components',
'clsx',
"@fortawesome/fontawesome-free",
'html-react-parser',
'react-text-mask',
'@ant-design/icons',
'text-mask-addons/dist/createNumberMask',
'react-otp-input',
'date-fns',
'moment',
'rxjs',
'rxjs/operators',
'antd/lib/table',
'virtualizedtableforantd4',
'draft-js',
'react-toastify',
'draft-convert',
'antd/lib/switch',
'moment/locale/id',
'moment/locale/en-gb',
'rc-picker/lib/generate/dateFns',
'antd/lib/date-picker/generatePicker',
'date-fns/locale',
],
exclude: []
}
})
}
};
Expected behavior
Screenshots and/or logs
N/A
Environment
- OS: macOS Monterey v12.3
- Node.js version: v14.17.0
- NPM version: 6.14.4
Additional context
N/A
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Issues · storybookjs/builder-vite - GitHub
A builder plugin to run and build Storybooks with Vite - Issues ... [Bug] ERR_PACKAGE_PATH_NOT_EXPORTED error with SvelteKit 1.0.0 and Vite 4 bug...
Read more >First-class Vite support in Storybook 7.0 : r/reactjs - Reddit
I set up Storybook in my company's app a long time ago to get speedy component development in isolation from the rest of...
Read more >Storybook Performance: Vite vs Webpack - JS.ORG
We benchmarked both builders to see which is faster.
Read more >Error: PostCSS plugin tailwindcss requires PostCSS 8
I tried to uninstall postcss and tailwindcss but it does not work. Need help. Module build failed (from ./node_modules/postcss-loader/src/index.
Read more >failed to fetch dynamically imported module storybook vite
Describe the bug My company is currently trying to migrate our monorepo to using pnpm workspaces and we've having issues with our storybooks....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried it and it worked. I think this issue has been resolved. Thanks, @IanVS for your help.
@joshwooding I wonder if we should always default to
react-docgen
, and maybe give some kind of suggestion in the terminal output to usereact-docgen-typescript
if we detect typescript. The failure mode exposed here when we guess incorrectly is pretty disastrous.