pvpokemon/webpack.config.prod.js
2019-01-14 00:31:46 -05:00

46 lines
1.6 KiB
JavaScript

const webpack = require('webpack');
const config = require('./webpack.config');
const options = require('./webpack.config.options');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
module.exports = function(env) {
var generatedConfig = config(env, false);
generatedConfig.mode = 'production';
generatedConfig.plugins = [
new webpack.LoaderOptionsPlugin({
minimize: true
}),
new StyleLintPlugin({
configFile: '.stylelintrc',
context: 'src',
emitErrors: true,
failOnError: true,
quiet: false,
}),
// Lesman 10/03/2017
// This plugin enforces case sensitive paths in order
// to give build consistency across systems (OsX is not case sensitive)
// however the plugin is relatively slow (adds ~20 seconds to the build)
// and our jenkins system is already case-sensitive so it's not critical
// The plugin does provide better error message though, so we may want to
// re-enable it if case-sensitivity build problems are an issue
// new CaseSensitivePathsPlugin({debug: true}),
new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: true
// },
sourceMap: true
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV' : JSON.stringify('production')
}),
].concat(options.getPlugins(env || {}));
return generatedConfig;
}