Description
As was partly reported in #75, with Webpack 4 CSS chunks loaded with react-universal-component are not being hot reloaded correctly for me. That issue was closed so I wanted to restart the conversation here.
The hot reload is being accepted by the client but the main.css file is being reloaded instead of the specific CSS chunk. In my fork of the Universal Demo for Webpack 4, when I change an async component's CSS the console shows:
[HMR] Updated modules:
process-update.js:116 [HMR] - ./src/css/Foo.styl
process-update.js:121 [HMR] App is up to date.
hotModuleReplacement.js:119 [HMR] css reload http://localhost:3000/static/main.css
I'm expecting that it should reload http://localhost:3000/static/components-Foo.css.
Versions:
node 10.2.1
react-universal-component 3.0.0-alpha.2
webpack-flush-chunks 2.0.1
extract-css-chunks-webpack-plugin 3.0.5
Project showing behavior:
https://github.com/sjwood25890/universal-demo/tree/webpack-4-RUC-3
FWIW, digging around in hotModuleReplacement.js
shows me that getCurrentScriptUrl
is always returning the main.js file instead of the chunk's JS file. If I force a reloadAll()
on every CSS hot update I get the desired result on the client, which is obviously not the ideal way to do this, but does make me think the issue is in identifying which CSS file to reload in hotModuleReplacement.js
.