webpack-hot-server-middleware icon indicating copy to clipboard operation
webpack-hot-server-middleware copied to clipboard

Show better error when specified chunk name is not present in stats.

Open threehams opened this issue 6 years ago • 2 comments

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.

threehams avatar Jul 01 '18 18:07 threehams

Coverage Status

Coverage remained the same at 100.0% when pulling e32281cc41209bdc66d017924a72e11ac841acaf on threehams:missing-chunk-error into dc02c342ec77de742bf15c361eb846af5e4a55db on 60frames:master.

coveralls avatar Jul 01 '18 18:07 coveralls

@threehams I'll aim to look at this shortly -- sorry for the delay

richardscarrott avatar Nov 15 '18 12:11 richardscarrott