-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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 - hmr check api no longer returns updated modules #12408
Comments
/cc @sokra |
Just an FYI: I created an issue with webpack-hot-middleware that details an eventual side-effect of this: webpack-contrib/webpack-hot-middleware#398. I believe that it's the exact same thing going on as in your linked issue (webpack-contrib/webpack-hot-middleware#390) |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
bump |
Hi! I'm facing the same problem, there is any update ? |
Facing the same issue, by stepping into it a little further, I find this code in chunkIds.forEach(function (chunkId) {
if (
$hasOwnProperty$($installedChunks$, chunkId) &&
$installedChunks$[chunkId] !== undefined
) {
// HERE
promises.push($loadUpdateChunk$(chunkId, updatedModulesList));
currentUpdateChunks[chunkId] = true;
}
}); This calls ? Template.asString([
"var currentUpdatedModulesList;",
"var waitingUpdateResolves = {};",
// HERE
"function loadUpdateChunk(chunkId) {",
Template.indent([
`return new Promise(${runtimeTemplate.basicFunction(
"resolve, reject",
[ It only defines one parameter, it never pushes any entry into But weirdly, this long lived issue only affects us in recent several days when we deleted our lock file and have a fresh install, not sure if there is any other root causes |
bump |
any news on this ? |
is there any progress? |
Send a PR |
fixed |
Bug report
webpack-contrib/webpack-hot-middleware#390
I've been investigating the cause.
as per the documentation https://webpack.js.org/api/hot-module-replacement/#check
it expects check to yield an array of updated modules. It uses this to compare to the updated modules in order to decide whether to reload.
when I debug I see:
https://github.com/webpack/webpack/blob/master/lib/hmr/HotModuleReplacement.runtime.js#L257
check doesn't add any modules, it passes the array to the runtime to update.
https://github.com/webpack/webpack/blob/master/lib/hmr/JavascriptHotModuleReplacement.runtime.js#L413
The runtime doesn't add any modules, but it passes the array on to the loader
webpack/lib/web/JsonpChunkLoadingRuntimeModule.js
Line 280 in 80c5041
The loader doesn't accept the second argument so it doesn't add any modules to the array
It looks like a bug because the documentation wasn't changed and the code still references the updatedModules array.
Seems it was introduced in webpack 5 alpha. 0 here:
9d91861#diff-99b22d1932803b7795bbe843d01cdf63d32e52a247610bfd9cffb95170227cc6
it seems that the node/ version had the updated module id's, but the web version does not.
Other relevant information:
webpack version: 5.3.1
Node.js version: 12
Operating System: windows 10
Additional tools:
The text was updated successfully, but these errors were encountered: