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

Commit

Permalink
fix(webpack): when analyzing stats, factor in new shape of ModuleConc…
Browse files Browse the repository at this point in the history
…atenation info
  • Loading branch information
danbucholtz committed Sep 27, 2017
1 parent eeed98b commit 00cf038
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,23 @@ function webpackBuildComplete(stats: any, context: BuildContext, webpackConfig:
// set the module files used in this bundle
// this reference can be used elsewhere in the build (sass)
if (!context.isProd || !context.optimizeJs) {
const files: string[] = stats.compilation.modules.map((webpackObj: any) => {
if (webpackObj.resource) {
return webpackObj.resource;
} else {
return webpackObj.context;

const files: string[] = [];
stats.compilation.modules.forEach((webpackModule: any) => {
if (webpackModule.resource) {
files.push(webpackModule.resource);
} else if (webpackModule.context) {
files.push(webpackModule.context);
} else if (webpackModule.fileDependencies) {
webpackModule.fileDependencies.forEach((filePath: string) => {
files.push(filePath);
});
}
}).filter((path: string) => {
// just make sure the path is not null
return path && path.length > 0;
});

context.moduleFiles = files;
const trimmedFiles = files.filter(file => file && file.length > 0);

context.moduleFiles = trimmedFiles;
}

return setBundledFiles(context);
Expand Down

0 comments on commit 00cf038

Please sign in to comment.