Skip to content

webpack 5 - hmr check api no longer returns updated modules #12408

@lukeapage

Description

@lukeapage

Bug report

webpack/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

"function loadUpdateChunk(chunkId) {",

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions