diff --git a/lib/Compilation.js b/lib/Compilation.js index 66ae146f4..38c8842be 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -3192,6 +3192,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } _runCodeGenerationJobs(jobs, callback) { + if (jobs.length === 0) { + return callback(); + } let statModulesFromCache = 0; let statModulesGenerated = 0; const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } = diff --git a/test/__snapshots__/StatsTestCases.basictest.js.snap b/test/__snapshots__/StatsTestCases.basictest.js.snap index 393722bd8..887b658c7 100644 --- a/test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/test/__snapshots__/StatsTestCases.basictest.js.snap @@ -1365,7 +1365,6 @@ asset main.js 84 bytes [emitted] (name: ma LOG from webpack.Compilation 1 modules hashed, 0 from cache (1 variants per module in average) 100% code generated (1 generated, 0 from cache) - NaN% code generated (0 generated, 0 from cache) + 24 hidden lines LOG from webpack.FlagDependencyExportsPlugin