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;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
let copyDynamic = build.subTask('copy-dynamic-load-files', function (gulp, buildOptions, done) {
|
|
|
|
gulp.src('./node_modules/sharepoint-modern-script-editor-propertypane/bundles/editor-pop-up.min.js')
|
|
|
|
.pipe(gulp.dest('./temp/deploy'))
|
|
|
|
.pipe(gulp.dest('./dist'));
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
build.rig.addPostBuildTask(copyDynamic);
|
|
|
|
|
|
|
|
build.initialize(gulp);
|