@gravityforms/gulp-tasks
Version:
Configurable Gulp tasks for use in Gravity Forms projects.
42 lines (39 loc) • 972 B
JavaScript
/**
* External Dependencies
*/
const webpack = require( 'webpack' );
const { merge, mergeWithCustomize, customizeArray } = require( 'webpack-merge' );
const getConfig = require( '../../../config' );
const { config } = getConfig();
/**
* Internal Dependencies
*/
const base = require( './base.js' );
const minimizer = require( '../optimization/minimizer' );
const output = merge( {
filename: '[name].min.js',
chunkFilename: '[name].[chunkhash].min.js',
}, config.webpack?.overrides?.output || {} );
module.exports = mergeWithCustomize( {
customizeArray: customizeArray( {
plugins: 'append',
} ),
} )( base, {
cache: true,
mode: 'production',
devtool: false,
output,
plugins: [
new webpack.DefinePlugin( {
'process.env.RUN_MODE': JSON.stringify( 'production' ),
} ),
new webpack.LoaderOptionsPlugin( {
debug: false,
} ),
],
optimization: {
emitOnErrors: false,
concatenateModules: true, //ModuleConcatenationPlugin
minimizer,
},
} );