webpack-hot-server-middleware
webpack-hot-server-middleware copied to clipboard
Show better error when specified chunk name is not present in stats.
Why
When the chunk specified in configuration (or the default "main" chunk name) is not present in the server stats.assetsByChunkName
, the current behavior is to silently fall back to an empty string. This causes a crash later on in readFileSync (as it attempts to read a directory instead of a file). This error is not propagated, which later causes a non-helpful error of serverRenderer is not a function
.
How
Throw an informative error if the chunk does not exist in server stats.
Coverage remained the same at 100.0% when pulling e32281cc41209bdc66d017924a72e11ac841acaf on threehams:missing-chunk-error into dc02c342ec77de742bf15c361eb846af5e4a55db on 60frames:master.
@threehams I'll aim to look at this shortly -- sorry for the delay