Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of emitting stats during incremental build #1098

Merged
merged 1 commit into from
Feb 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/webpack/src/ember-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,18 @@ const Webpack: PackagerConstructor<Options> = class Webpack implements Packager
return fileParts.join('.');
}

private summarizeStats(multiStats: webpack.StatsCompilation): BundleSummary {
private summarizeStats(multiStats: webpack.MultiStats): BundleSummary {
let output: BundleSummary = {
entrypoints: new Map(),
lazyBundles: new Set(),
variants: this.variants,
};
for (let [variantIndex, variant] of this.variants.entries()) {
let { entrypoints, assets } = multiStats.children![variantIndex];
let { entrypoints, assets } = multiStats.stats[variantIndex].toJson({
all: false,
entrypoints: true,
assets: true,
});

// webpack's types are written rather loosely, implying that these two
// properties may not be present. They really always are, as far as I can
Expand Down Expand Up @@ -443,7 +447,7 @@ const Webpack: PackagerConstructor<Options> = class Webpack implements Packager
return output;
}

private runWebpack(webpack: webpack.MultiCompiler): Promise<webpack.StatsCompilation> {
private runWebpack(webpack: webpack.MultiCompiler): Promise<webpack.MultiStats> {
return new Promise((resolve, reject) => {
webpack.run((err, stats) => {
try {
Expand Down Expand Up @@ -476,7 +480,7 @@ const Webpack: PackagerConstructor<Options> = class Webpack implements Packager
})
);
}
resolve(stats.toJson());
resolve(stats);
} catch (e) {
reject(e);
}
Expand Down