-
-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack 5.beta.11: HMR error Cannot read property 'getModuleIndex2' of undefined #487
Comments
Yes, please create reproducible test repo? |
Hi @evilebottnawi , I've tried to make the repo as small as possible: https://github.com/Levdbas/webpack-mini-css-extract-plugin-hmr-error While doing that I found out that removing It even might have something to do with my PR to fix the working of this plugin with Webpack 5 altogether: webpack/webpack#10127 |
getModuleIndex2 is deprecated but still exists, this is a problem with groupsIterable being a empty array |
Seems like HotUpdateChunk has no ChunkGroups to me. Can we just skip some checks if it is a HotUpdateChunk. Not sure the ChunkGroups matter in a hot update. |
@fivethreeo I would be happy to test any fix you are able to come up with. 😄 |
Error seems to be gone in [email protected] but there are new errors about ordering |
Strange, unable to reproduce bug now, even in beta.11 |
I am fairly certain I saw the exact same issue with hmr but quickly went
back to v4.
…On Mon, Mar 2, 2020, 10:36 Øyvind Saltvik ***@***.***> wrote:
Strange, unable to reproduce bug now, even in beta.11
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#487?email_source=notifications&email_token=AOOOHG5FYR7XOIS7753RYTTRFPHADA5CNFSM4KA566QKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENPYJRI#issuecomment-593462469>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOOOHG4KXW24VBQMVYC7OTTRFPHADANCNFSM4KA566QA>
.
|
Me too, quite sure I saw it |
But, working fine here, see the run above |
Still seeing this with [email protected] and webpack-dev-server It occurs when changing css and expecting a hot reload:
|
This should be fixed in webpack/webpack The HotUpdateChunk should have ChunkGroups in |
Is this using my example? If not can you post your webpack config? |
I tried with webpack-dev-server too, no such error here. Check out my example and see if it runs locally for you. git clone https://github.com/fivethreeo/webpack-mini-css-extract-plugin-hmr-error.git |
@fivethreeo I pulled your example repo and I am able to reproduce by starting the dev server and then making a change to test.scss Although it looks like the app is not necessary loading the css (browser console complains about the mimetype being text/html). |
Ok, reinstalled node modules and can confirm now. |
In this line the destructuring does not yield a ChunkGroup even though the set is not empty. This chunkGroup is only needed to fall back if we are below webpack 4. if in We change to if (typeof chunkGroup === 'undefined' || typeof chunkGroup.getModuleIndex2 === 'function') We get more interesting errors :) |
Looking at razzle, I see they just use mini-css-extract-plugin when building production css. Just style-loader is used in development with hmr. |
So, is there any fix for this yet? I can't get this to work at all, on beta 13 of the webpack 5. Is there a workaround until a fix is out?? |
No fix yet, but just don't use this with hmr in dev. Just use the style loader instead when developing and just use this plugin when building the production build. |
Exact same issue here. Let share some debug experience. Hopefully it can give the author some insights to fix. WhenI changed something and saving the stylesheet. It triggered |
still same issues in |
Still same issue in This is a show-stopper bug completely preventing HMR with MiniCssExtractPlugin in Webpack 5. Please give this some attention 🙏 |
@evilebottnawi I will take a look on this, any blockers? |
@vankop go ahead, no blockers |
I have the same problem with Webpack
I get the following error.
But if I replace in the Webpack configuration the
Now when I run the application for the first time everything loads properly, no errors, and the styles file loads ok, but as soon I make the minimum change in the CSS files after reloads is when I get the error message. I don't know exactly what changes in NOTE: |
I have to ask. Is there any way to fix it in the mini-css-extract plugin or do we have to wait for webpack? |
fix will be in near future |
I tried out the update, but seeing a different error now. Hope it helps.
Using the latest |
@slightlyfaulty Big thanks for testing, WIP on compatibility more |
@slightlyfaulty it is weird what we have HMR tests and nothing is broken, maybe you can provide simple reproducible test repo? |
@slightlyfaulty , are you using weback-dev-middleware as well? Might have something to do with that. I've ran into the same issue after updating my initial test repository: https://github.com/Levdbas/webpack-mini-css-extract-plugin-hmr-error from #487 (comment)_ . @evilebottnawi minimal test repo is updated. |
@Levdbas thanks, I will look at this in near future |
EDIT: Sorry @Levdbas I was thinking of @evilebottnawi I'll try to set up a minimal repro for the error I'm seeing. |
@evilebottnawi slightlyfaulty/webpack-mcep-repro-487
|
Nothing changes? Still not working. |
This issue changed from a missing getModuleIndex2 on undefined to a missing getModulePostOrderIndex on undefined, so nothing changed. So the error occurs before. |
Please try https://github.com/webpack-contrib/mini-css-extract-plugin/releases/tag/v0.11.3, if you faced with issue(s)/problems, please open new issue with simple reproducible test repo, thanks for using webpack |
HMR code
Expected Behavior
Actual Behavior
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.
The text was updated successfully, but these errors were encountered: