Migration to Storybook 4 issue with webpack config
See original GitHub issueHi Team,
During migration the storybook to new version 4.0.7, there is an issue in starting the storybook. Webpack is freaking out. The application is based on Create-React-App 1 and storybook has an extended webpack.config.js. There are two issues:
- Failed to load presets
- Cannot read property ‘rules’ of undefined (During the loading custom webpack config task)
The webpack config looks like:
const path = require("path")
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
module.exports = (baseConfig, env, config) => {
baseConfig.module.rules.push({
test: /\.css$/,
loaders: [
'style-loader',
'css-loader'
],
include: path.resolve(__dirname, "../")
});
config.module.rules.push({
test: /\.tsx?$/,
loader: [
'thread-loader',
'ts-loader?happyPackMode=true',
'react-docgen-typescript-loader'
]
}, {
test: /\.md$/,
loader: [
'thread-loader',
'markdown-loader'
]
})
config.plugins.push(new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
watch: path.resolve(__dirname, "../stories"),
workers: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
}))
config.resolve.extensions.push(".ts", ".tsx")
return config;
}
Waiting for some pointers from your side in order to rectify the problem.
Thanks in advance Amit
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Storybook 4 Migration Guide
Upgrading the Storybook package; Dealing with Webpack 4 / Babel 7 issues if you have them; Dealing with addons and minor breaking changes....
Read more >Storybook Webpack Migration - Nx
Migrating · 1. adjust the main.js file · 2. Move any custom webpack configuration to webpackFinal · 3. Remove the root-level .storybook/webpack.config.js file...
Read more >Migrating to Webpack 5 at smallcase - Medium
Borrow from the main webpack config in custom storybook webpack config ... There were issues which became blockers for storybook6 migration ...
Read more >Migrating Storybook to 6.4 err: webpack < 5 used to include ...
Migrating Storybook to 6.4 err: webpack < 5 used to include polyfills ... Verify if you need this module and configure a polyfill...
Read more >@storybook/builder-vite - npm
Getting started with Vite and Storybook (on a new project); Migration from webpack / CRA; Customize Vite config; Svelte Customization ...
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 Free
Top 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

Same problem here. @amittkSharma have you found a solution?
EDIT: Actually, I managed to make it work. I simply changed .storybook/webpack.config.js from
module.exports = (baseConfig, env, config) => {tomodule.exports = ({ config, mode }) => {I could even change the npm script back to
"storybook": "start-storybook -p 9009 -s public",@igor-dv: Here is the basic repo structure, please take a look at it. In my system, I am not able to reproduce the above error as there were some updates in the past but feel free to check it.
Thanks Amit