2020-05-06 03:43:32 -04:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// check if gulp dist was called
|
|
|
|
if (process.argv.indexOf('dist') !== -1) {
|
|
|
|
// add ship options to command call
|
|
|
|
process.argv.push('--ship');
|
|
|
|
}
|
|
|
|
|
|
|
|
const gulp = require('gulp');
|
|
|
|
const build = require('@microsoft/sp-build-web');
|
|
|
|
const gulpSequence = require('gulp-sequence');
|
|
|
|
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
|
|
|
|
|
|
|
|
// Create clean distrubution package
|
|
|
|
gulp.task('dist', gulpSequence('clean', 'bundle', 'package-solution'));
|
|
|
|
// Create clean development package
|
|
|
|
gulp.task('dev', gulpSequence('clean', 'bundle', 'package-solution'));
|
|
|
|
|
|
|
|
/********************************************************************************************
|
|
|
|
* Adds an alias for handlebars in order to avoid errors while gulping the project
|
|
|
|
* https://github.com/wycats/handlebars.js/issues/1174
|
|
|
|
* Adds a loader and a node setting for webpacking the handlebars-helpers correctly
|
|
|
|
* https://github.com/helpers/handlebars-helpers/issues/263
|
|
|
|
********************************************************************************************/
|
|
|
|
build.configureWebpack.mergeConfig({
|
|
|
|
additionalConfiguration: (generatedConfiguration) => {
|
|
|
|
|
|
|
|
generatedConfiguration.resolve.alias = { handlebars: 'handlebars/dist/handlebars.min.js' };
|
|
|
|
|
2024-03-31 08:05:39 -04:00
|
|
|
/*generatedConfiguration.module.rules.push(
|
2020-05-06 03:43:32 -04:00
|
|
|
{ test: /\.js$/, loader: 'unlazy-loader' }
|
2024-03-31 08:05:39 -04:00
|
|
|
);*/
|
2020-05-06 03:43:32 -04:00
|
|
|
|
|
|
|
generatedConfiguration.node = {
|
|
|
|
fs: 'empty'
|
|
|
|
}
|
|
|
|
|
|
|
|
return generatedConfiguration;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2024-03-31 08:05:39 -04:00
|
|
|
var getTasks = build.rig.getTasks;
|
|
|
|
build.rig.getTasks = function () {
|
|
|
|
var result = getTasks.call(build.rig);
|
2020-05-06 03:43:32 -04:00
|
|
|
|
2024-03-31 08:05:39 -04:00
|
|
|
result.set('serve', result.get('serve-deprecated'));
|
2020-05-06 03:43:32 -04:00
|
|
|
|
2024-03-31 08:05:39 -04:00
|
|
|
return result;
|
|
|
|
};
|
2020-05-06 03:43:32 -04:00
|
|
|
|
|
|
|
build.initialize(gulp);
|