The chunk id is affected by modules inside that chunk. So if I have a initial chunk with module a, let's say its id is src_a, then updated the chunk with modules a and b, the chunk id changes to src_a-src_b, the hot-update.json is like
{
"m": [],
"r": ["src_a"],
"c": [],
}
However the new chunk src_a-src_b is not appear here, because it's a new chunk to hmr, it should be loaded again by its parents. However if it doesn't have parent (initial chunk), it cannot be loaded, thus the new module b cannot be loaded, the error above is caused by this.
However in Webpack, if error occur, the page will reload, so it's fine if not using this plugin. This plugin will handle error occured in HMR, so Webpack do not know if something wrong during hmr
I'm wondering if we can throw this error back to Webpack instead of consuming it
I modify a module like:
There will be an error![image](https://github.com/pmmmwh/react-refresh-webpack-plugin/assets/57202839/146e268a-fd9f-4816-907d-6a332ff442ee)
Reason
The chunk id is affected by modules inside that chunk. So if I have a initial chunk with module
a
, let's say its id issrc_a
, then updated the chunk with modulesa
andb
, the chunk id changes tosrc_a-src_b
, thehot-update.json
is likeHowever the new chunk
src_a-src_b
is not appear here, because it's a new chunk to hmr, it should be loaded again by its parents. However if it doesn't have parent (initial chunk), it cannot be loaded, thus the new moduleb
cannot be loaded, the error above is caused by this.However in Webpack, if error occur, the page will reload, so it's fine if not using this plugin. This plugin will handle error occured in HMR, so Webpack do not know if something wrong during hmr
I'm wondering if we can throw this error back to Webpack instead of consuming it