Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 00cf038

Browse files
committed
fix(webpack): when analyzing stats, factor in new shape of ModuleConcatenation info
1 parent eeed98b commit 00cf038

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/webpack.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,23 @@ function webpackBuildComplete(stats: any, context: BuildContext, webpackConfig:
9696
// set the module files used in this bundle
9797
// this reference can be used elsewhere in the build (sass)
9898
if (!context.isProd || !context.optimizeJs) {
99-
const files: string[] = stats.compilation.modules.map((webpackObj: any) => {
100-
if (webpackObj.resource) {
101-
return webpackObj.resource;
102-
} else {
103-
return webpackObj.context;
99+
100+
const files: string[] = [];
101+
stats.compilation.modules.forEach((webpackModule: any) => {
102+
if (webpackModule.resource) {
103+
files.push(webpackModule.resource);
104+
} else if (webpackModule.context) {
105+
files.push(webpackModule.context);
106+
} else if (webpackModule.fileDependencies) {
107+
webpackModule.fileDependencies.forEach((filePath: string) => {
108+
files.push(filePath);
109+
});
104110
}
105-
}).filter((path: string) => {
106-
// just make sure the path is not null
107-
return path && path.length > 0;
108111
});
109112

110-
context.moduleFiles = files;
113+
const trimmedFiles = files.filter(file => file && file.length > 0);
114+
115+
context.moduleFiles = trimmedFiles;
111116
}
112117

113118
return setBundledFiles(context);

0 commit comments

Comments
 (0)