debug-require-webpack-plugin: Handle missing chunkGraph.

This seems to be triggered by mini-css-extract-plugin@2.4.0.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-10-16 14:06:08 -07:00 committed by Tim Abbott
parent ea88ec9e06
commit 51971a48f3
1 changed files with 4 additions and 0 deletions

View File

@ -74,6 +74,10 @@ export default class DebugRequirePlugin implements WebpackPluginInstance {
compilation.mainTemplate.hooks.bootstrap.tap(
"DebugRequirePlugin",
(source: string, chunk: Chunk) => {
if (compilation.chunkGraph === undefined) {
return source;
}
const ids: [string, string | number][] = [];
let hasDebugRequire = false;
compilation.chunkGraph.hasModuleInGraph(