TypeError: Cannot read property 'tap' of undefined
See original GitHub issueCurrent behaviour 💣
info @storybook/react v6.1.21
info
info => Loading presets
info => Loading presets
info => Adding stories defined in ".storybook\main.js"
info => Using default Webpack setup
ERR! TypeError: Cannot read property 'tap' of undefined
ERR! at HtmlWebpackPlugin.apply (.\node_modules\html-webpack-plugin\index.js:41:31)
ERR! at webpack (.\node_modules\@storybook\core\node_modules\webpack\lib\webpack.js:51:13)
ERR! at startPreview (.\node_modules\@storybook\core\dist\server\dev-server.js:420:39)
ERR! at async Promise.all (index 0)
ERR! at async storybookDevServer (.\node_modules\@storybook\core\dist\server\dev-server.js:505:29)
ERR! at async buildDevStandalone (.\node_modules\@storybook\core\dist\server\build-dev.js:317:33)
ERR! at async buildDev (.\node_modules\@storybook\core\dist\server\build-dev.js:380:3)
ERR! TypeError: Cannot read property 'tap' of undefined
ERR! at HtmlWebpackPlugin.apply (.\node_modules\html-webpack-plugin\index.js:41:31)
ERR! at webpack (.\node_modules\@storybook\core\node_modules\webpack\lib\webpack.js:51:13)
ERR! at startPreview (.\node_modules\@storybook\core\dist\server\dev-server.js:420:39)
ERR! at async Promise.all (index 0)
ERR! at async storybookDevServer (.\node_modules\@storybook\core\dist\server\dev-server.js:505:29)
ERR! at async buildDevStandalone (.\node_modules\@storybook\core\dist\server\build-dev.js:317:33)
ERR! at async buildDev .\node_modules\@storybook\core\dist\server\build-dev.js:380:3)
Expected behaviour ☀️
Html-webpack-plugin will be compatible with storybook
Reproduction Example 👾
Packages:
- "@storybook/react": "^6.1.21",
- "babel-loader": "^8.1.0",
- "html-webpack-plugin": "^5.2.0",
- "mini-css-extract-plugin": "^1.3.9",
- "webpack": "^5.24.3",
- "webpack-cli": "^4.2.0",
- "webpack-dev-server": "^3.11.0"
Content of .storybook/main.js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
stories: ['../src/Examples.stories.tsx'],
webpackFinal: (config) => {
return { ...config,
plugins: [
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin(),
],
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: require('../../babel.config.js')
}
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.(png|svg|gif)$/,
loader: 'file-loader',
options: {
outputPath: 'images',
name: '[name].[ext]'
}
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
loader: 'file-loader',
options: {
outputPath: 'fonts',
name: '[name].[ext]'
}
},
]
} };
},
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'tap' of undefined #5781
I need to install webpack for react-styleguidist, but it seems if the version doesn't match the one Next is using this error occurs....
Read more >ProgressPlugin TypeError: Cannot read property 'tap' of ...
In my case the error was that I put a plugin under resolve.plugins , instead of directly in plugins inside the webpack config....
Read more >Cannot read property 'tap' of undefined in ts-loader #14157
Describe the bug. Module build failed (from ./node_modules/ts-loader/index.js): TypeError: Cannot read property 'tap' of undefined. To Reproduce ...
Read more >Cannot read property 'tap' of undefined at HtmlWebpackPlugin ...
【Webpack】TypeError: Cannot read property 'tap' of undefined at HtmlWebpackPlugin.
Read more >Webpack: Cannot read property 'tap' of undefined-Reactjs
[Solved]-React- Webpack: Cannot read property 'tap' of undefined-Reactjs ... I had the same exact problem. You have to add @babel/preset-react library to your ......
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
TypeError: Cannot read property 'tap' of undefinedprobably happens due to mixing of incompatible html-webpack-plugin and webpack versions.TypeError: The 'compilation' argument must be an instance of Compilationprobably happens due to having duplicate webpack copies in node_modules (either of the same or different versions) mixing together in a single compilation.Check your npm/yarn/pnpm install log. Do you see any peerDependency warnings? These are the first that require fixing. Then make sure you don’t have duplicate webpack versions. You can do that by examining the lock files or node_modules itself.
npm listoryarn listmight come in handy.#1618
In my case, ts-loader occurs the issue.
webpack.config.js
Not work
Work