1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 15:20:06 +02:00
copilot/frontend/webpack/plugins.js

55 lines
1.8 KiB
JavaScript
Raw Normal View History

const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
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;
module.exports = {
'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({
'process.env': {
2017-02-24 14:13:36 +02:00
BASELINE_GRID: JSON.stringify(process.env.BASELINE_GRID),
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
APP_NAME: JSON.stringify(pkg.name),
APP_VERSION: JSON.stringify(pkg.version)
}
}),
'shell': () => new WebpackShellPlugin({
onBuildStart: ['npm run build-locales']
}),
'uglify-js': () => new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
screw_ie8: true,
warnings: false
},
mangle: {
screw_ie8: true
},
output: {
comments: false,
indent_level: 2,
screw_ie8: true
}
})
};