hard-source-webpack-plugin icon indicating copy to clipboard operation
hard-source-webpack-plugin copied to clipboard

Doesn't always work with DllreferencePlugin

Open davidsielert opened this issue 7 years ago • 1 comments

This is probably related to #18 I keep getting seemingly random errors like this

Uncaught TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (commons.js:713)

When I either disable the hardsourceplugin or clear its cache it functions again..

Actually I'm also using the commons plugin as well, could be related to either.. I need to try and work up a test case to replicate it but its likely going to take some time..

davidsielert avatar Jan 08 '18 03:01 davidsielert

Thanks @davidsielert for filing this issue. One thing that might help you track down what's going on is logging the failing moduleId.

It's pretty like these lines are where the error originates in your webpack output.

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

Naturally that will cause an error if something is expecting a module at that moduleId. Logging the id you can backtrack that in the records.json hard-source requires to be output in the cache for that build.

This feels familiar and I'm trying to remember something like that happened to me previously. I'm doubtful of it being connected to DllReference or CommonsChunk. Previously I saw a symptom where a module was being rebuilt and assigned a new id instead of its old id because it hadn't a different identifier that the old version and a cached module that depended on the rebuilt module continued to point at the old id. Pretty sure that was relative context modules that was fixed in 0.5.11.

This issue seems pretty similar to that. This is probably a module being rebuilt with a new id and a cached module needs to update or the rebuilt module needs to be assigned the correct module id.

mzgoddard avatar Jan 08 '18 18:01 mzgoddard