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,47 +17,45 @@ function reduceSize(stats: any) { ...@@ -18,47 +17,45 @@ function reduceSize(stats: any) {
} }
for (const module of chunk.modules) { for (const module of chunk.modules) {
if (!module.name) { if (!module.id) {
continue continue
} }
const reducedModule: any = { if (!reducedChunk.modules) {
type: module.type, reducedChunk.modules = []
moduleType: module.moduleType,
size: module.size,
name: module.name,
} }
if (module.reasons) { reducedChunk.modules.push(module.id)
for (const reason of module.reasons) { }
if (!reason.name) {
continue
}
if (!reducedModule.reasons) { return reducedChunk
reducedModule.reasons = [] })
}
stats.modules = stats.modules.map((module: any) => {
const reducedModule: any = {
type: module.type,
moduleType: module.moduleType,
size: module.size,
name: module.name,
}
reducedModule.reasons.push({ if (module.reasons) {
id: reason.id, for (const reason of module.reasons) {
}) if (!reason.moduleName || reason.moduleId === module.id) {
continue
} }
}
modules.set(module.id, reducedModule) if (!reducedModule.reasons) {
reducedModule.reasons = []
}
if (!reducedChunk.modules) { reducedModule.reasons.push(reason.moduleId)
reducedChunk.modules = []
} }
reducedChunk.modules.push(module.id)
} }
return reducedChunk return [module.id, reducedModule]
}) })
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