2016-12-05 22:11:55 +02:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const WebpackShellPlugin = require('webpack-shell-plugin');
|
2017-02-07 17:52:24 +02:00
|
|
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
|
|
|
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); // eslint-disable-line max-len
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const pkg = require('../package.json');
|
|
|
|
const paths = require('./paths');
|
|
|
|
|
|
|
|
const {
|
|
|
|
FRONTEND
|
|
|
|
} = paths;
|
2016-12-05 22:11:55 +02:00
|
|
|
|
|
|
|
module.exports = {
|
2017-02-07 17:52:24 +02:00
|
|
|
'manifest': () => new ManifestPlugin({
|
|
|
|
fileName: 'asset-manifest.json'
|
|
|
|
}),
|
|
|
|
'watch-missing-node-modules': () => new WatchMissingNodeModulesPlugin(
|
|
|
|
path.join(FRONTEND, 'node_modules')
|
|
|
|
),
|
|
|
|
'case-sensitive-paths': () => new CaseSensitivePathsPlugin(),
|
|
|
|
'no-errors': () => new webpack.NoEmitOnErrorsPlugin(),
|
|
|
|
'occurrence-order': () => new webpack.optimize.OccurrenceOrderPlugin(true),
|
|
|
|
'aggressive-merging': () => new webpack.optimize.AggressiveMergingPlugin(),
|
|
|
|
'hot-module-replacement': () => new webpack.HotModuleReplacementPlugin(),
|
|
|
|
'named-modules': () => new webpack.NamedModulesPlugin(),
|
|
|
|
'define': () => new webpack.DefinePlugin({
|
2016-12-05 22:11:55 +02:00
|
|
|
'process.env': {
|
2017-02-24 14:13:36 +02:00
|
|
|
BASELINE_GRID: JSON.stringify(process.env.BASELINE_GRID),
|
2016-12-05 22:11:55 +02:00
|
|
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
|
|
|
|
APP_NAME: JSON.stringify(pkg.name),
|
|
|
|
APP_VERSION: JSON.stringify(pkg.version)
|
|
|
|
}
|
|
|
|
}),
|
2017-02-07 17:52:24 +02:00
|
|
|
'shell': () => new WebpackShellPlugin({
|
2016-12-05 22:11:55 +02:00
|
|
|
onBuildStart: ['npm run build-locales']
|
|
|
|
}),
|
2017-02-07 17:52:24 +02:00
|
|
|
'uglify-js': () => new webpack.optimize.UglifyJsPlugin({
|
2016-12-05 22:11:55 +02:00
|
|
|
sourceMap: true,
|
2017-02-07 17:52:24 +02:00
|
|
|
compress: {
|
|
|
|
screw_ie8: true,
|
|
|
|
warnings: false
|
|
|
|
},
|
|
|
|
mangle: {
|
|
|
|
screw_ie8: true
|
|
|
|
},
|
2016-12-05 22:11:55 +02:00
|
|
|
output: {
|
|
|
|
comments: false,
|
2017-02-07 17:52:24 +02:00
|
|
|
indent_level: 2,
|
|
|
|
screw_ie8: true
|
2016-12-05 22:11:55 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
};
|