Skip to content

Commit 34b881b

Browse files
committed
webpack-bundle-analyzer support
1 parent 86aa567 commit 34b881b

File tree

3 files changed

+387
-5
lines changed

3 files changed

+387
-5
lines changed

gulpfile.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const gulp = require('gulp');
44
const build = require('@microsoft/sp-build-web');
55
const fs = require('fs');
6+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
67

78
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
89

@@ -17,6 +18,16 @@ gulp.task('versionUpdater', (done) => {
1718
done();
1819
});
1920

21+
if (process.argv.indexOf('--size') !== -1) {
22+
build.configureWebpack.mergeConfig({
23+
additionalConfiguration: generatedConfiguration => {
24+
generatedConfiguration.plugins.push(new BundleAnalyzerPlugin());
25+
26+
return generatedConfiguration;
27+
}
28+
});
29+
}
30+
2031
build.initialize(gulp);
2132

2233
const karmaTask = build.karma;

0 commit comments

Comments
 (0)