Webpack 5.beta.11: HMR error Cannot read property 'getModuleIndex2' of undefined
See original GitHub issue- Operating System:
- Node Version: 13.3
- NPM Version: 6.13.1
- webpack Version: 5.0.0-beta.11
- mini-css-extract-plugin Version: 0.9
HMR code
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: '../',
sourceMap: CreateSourceMap,
hmr: watchMode,
reloadAll: true,
},
},
Expected Behavior
- Run webpack in watchmode with HMR
- compile css, no issue
- rerun, no issue 😃
Actual Behavior
- Run webpack in watchmode with HMR
- compile css, no issue
- rerun, issue 😦
TypeError: Cannot read property 'getModuleIndex2' of undefined at MiniCssExtractPlugin.renderContentAsset ([...]/node_modules/mini-css-extract-plugin/dist/index.js:301:27)
It seems that getModuleIndex2 is deprecated in webpack 5. I don’t know if this plugin is already compatible. If needed I can create a repo with minimal code.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:39 (10 by maintainers)
Top Results From Across the Web
Webpack 5 HMR issue - Cannot read property ...
First time it compiles properly, but when it comes to recompiling after code changes - it breaks with HookWebpackError: Cannot read property ' ......
Read more >Webpack Error: Cannot read property .toWebpackConfig of ...
I added a new dependency, pdf-lib, and now webpack/webpacker is blowing up. ... TypeError: Cannot read property 'toWebpackConfig' of undefined at Object.
Read more >Webpack 5: Why Minicssextractplugin.Loader Doesn't Let Hmr ...
Extract CSS from chunks into multiple stylesheets + HMR TypeError: Cannot read property 'getModuleIndex2' of undefined at ExtractCssChunksPlugin.
Read more >To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >webpack/types.d.ts - UNPKG
Error, stats?: T): void;. 659, }. 660, type Cell<T> = undefined | T;. 661, declare class Chunk {. 662, constructor(name?: string);.
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
I tried out the update, but seeing a different error now. Hope it helps.
Using the latest
webpack@5.0.0-beta.28
Still same issue in
webpack@5.0.0-beta.18
.This is a show-stopper bug completely preventing HMR with MiniCssExtractPlugin in Webpack 5. Please give this some attention 🙏