2017-03-12 08:25:26 -04:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const gulp = require('gulp');
|
2018-08-21 06:54:26 -04:00
|
|
|
const path = require('path');
|
2017-03-12 08:25:26 -04:00
|
|
|
const build = require('@microsoft/sp-build-web');
|
2018-08-21 06:54:26 -04:00
|
|
|
const bundleAnalyzer = require('webpack-bundle-analyzer');
|
2017-03-12 08:25:26 -04:00
|
|
|
|
2018-08-21 06:54:26 -04:00
|
|
|
build.configureWebpack.mergeConfig({
|
|
|
|
additionalConfiguration: (generatedConfiguration) => {
|
|
|
|
const lastDirName = path.basename(__dirname);
|
|
|
|
const dropPath = path.join(__dirname, 'temp', 'stats');
|
|
|
|
generatedConfiguration.plugins.push(new bundleAnalyzer.BundleAnalyzerPlugin({
|
|
|
|
openAnalyzer: false,
|
|
|
|
analyzerMode: 'static',
|
|
|
|
reportFilename: path.join(dropPath, `${lastDirName}.stats.html`),
|
|
|
|
generateStatsFile: true,
|
|
|
|
statsFilename: path.join(dropPath, `${lastDirName}.stats.json`),
|
|
|
|
logLevel: 'error'
|
|
|
|
}));
|
|
|
|
|
|
|
|
return generatedConfiguration;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-09-10 06:33:25 -04:00
|
|
|
build.initialize(gulp);
|