hard-source-webpack-plugin
hard-source-webpack-plugin copied to clipboard
TypeError: Cannot read property '0' of undefined
Using latest version of master it throws a exception at registration[0] expression:
Head is: 243543c7a3eb4e54f5be1df4eab54c749d7f7f7e
Process args: 0:"/Users/andrevale/.nvm/versions/node/v8.9.1/bin/node" 1:"{project}/server/index.js" 2:"--color"
exports.tap = (tapable, name, reason, callback) => {
if (tapable.hooks) {
tapable.hooks[name].tap(reason, callback);
} else {
if (!tapable.__hardSource_hooks || !tapable.__hardSource_hooks[name]) {
const registration =
knownPluginRegistrations[tapable.constructor.name][name];
exports.register(tapable, name, >>> registration[0] <<<, registration[1]);
Exception has occurred: TypeError
TypeError: Cannot read property '0' of undefined
at Object.exports.tap (.../hard-source-webpack-plugin/lib/util/plugin-compat.js:118:51)
at SupportMiniCssExtractPlugin.apply (.../hard-source-webpack-plugin/lib/SupportMiniCssExtractPlugin.js:7:18)
at HardSourceWebpackPlugin.apply (.../hard-source-webpack-plugin/index.js:460:41)
at Compiler.apply (.../.../node_modules/tapable/lib/Tapable.js:375:16)
at webpack (.../.../node_modules/webpack/lib/webpack.js:33:19)
at Promise (.../.../node_modules/.../lib/file.js:34:28)
at new Promise (<anonymous>)
at Server.hmr (.../.../node_modules/.../lib/file.js:30:10)
at Server.start (.../.../node_modules/.../index.js:100:43)
at start (.../.../server/index.js:719:10)
at module.exports (.../.../node_modules/throng/lib/throng.js:6:32)
at Object.<anonymous> (.../.../server/index.js:722:1)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
"webpack": "3.12.0",
@andreventuravale Your installed project dependencies are ... odd? MiniCss is enabled for webpack 4 based on discovering a part of webpack that only exists in webpack 4. Can you describe your project dependency folder layout so I can help figure this out or support it?
Fixing this may be deleting your node_modules directory and any npm/yarn cache and installing fresh.
I also encountered the same problem because I have both webpack@3 and webpack@4 in different node_modules deps, and the webpackFeatures.generator is set to true. After removing webpack@4, it works. I think this way of judging webpackFeatures should be improved.