Unverified Commit 44fa86e3 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Make sure all modules are included in the stats file (#21942)

parent e69a4d7a
...@@ -9,7 +9,6 @@ import { tracer, traceAsyncFn } from '../../tracer' ...@@ -9,7 +9,6 @@ import { tracer, traceAsyncFn } from '../../tracer'
const STATS_VERSION = 0 const STATS_VERSION = 0
function reduceSize(stats: any) { function reduceSize(stats: any) {
const modules = new Map()
stats.chunks = stats.chunks.map((chunk: any) => { stats.chunks = stats.chunks.map((chunk: any) => {
const reducedChunk: any = { const reducedChunk: any = {
id: chunk.id, id: chunk.id,
...@@ -18,10 +17,21 @@ function reduceSize(stats: any) { ...@@ -18,10 +17,21 @@ function reduceSize(stats: any) {
} }
for (const module of chunk.modules) { for (const module of chunk.modules) {
if (!module.name) { if (!module.id) {
continue continue
} }
if (!reducedChunk.modules) {
reducedChunk.modules = []
}
reducedChunk.modules.push(module.id)
}
return reducedChunk
})
stats.modules = stats.modules.map((module: any) => {
const reducedModule: any = { const reducedModule: any = {
type: module.type, type: module.type,
moduleType: module.moduleType, moduleType: module.moduleType,
...@@ -31,7 +41,7 @@ function reduceSize(stats: any) { ...@@ -31,7 +41,7 @@ function reduceSize(stats: any) {
if (module.reasons) { if (module.reasons) {
for (const reason of module.reasons) { for (const reason of module.reasons) {
if (!reason.name) { if (!reason.moduleName || reason.moduleId === module.id) {
continue continue
} }
...@@ -39,26 +49,13 @@ function reduceSize(stats: any) { ...@@ -39,26 +49,13 @@ function reduceSize(stats: any) {
reducedModule.reasons = [] reducedModule.reasons = []
} }
reducedModule.reasons.push({ reducedModule.reasons.push(reason.moduleId)
id: reason.id,
})
} }
} }
modules.set(module.id, reducedModule) return [module.id, reducedModule]
if (!reducedChunk.modules) {
reducedChunk.modules = []
}
reducedChunk.modules.push(module.id)
}
return reducedChunk
}) })
stats.modules = [...modules.entries()]
for (const entrypointName in stats.entrypoints) { for (const entrypointName in stats.entrypoints) {
delete stats.entrypoints[entrypointName].assets delete stats.entrypoints[entrypointName].assets
} }
...@@ -94,6 +91,7 @@ export default class BuildStatsPlugin { ...@@ -94,6 +91,7 @@ export default class BuildStatsPlugin {
warnings: false, warnings: false,
maxModules: Infinity, maxModules: Infinity,
chunkModules: true, chunkModules: true,
modules: true,
// @ts-ignore this option exists // @ts-ignore this option exists
ids: true, ids: true,
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment