UNPKG

1.15 kBJavaScriptView Raw
1/* eslint-env node */
2const webpack = require('webpack')
3const CompressionPlugin = require('compression-webpack-plugin')
4const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
5const ManifestPlugin = require('webpack-manifest-plugin')
6const UglifierSettings = require('./uglifier_settings')
7
8module.exports = ({ifProduction, ifDevelopment, keys, basePath})=>{
9 return [
10 new LodashModuleReplacementPlugin
11 , new webpack.EnvironmentPlugin(keys)
12 , new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/)
13 , new ManifestPlugin({
14 fileName: 'webpack-digest.json',
15 publicPath: `${basePath}/`
16 })
17
18 // , ifProduction(new webpack.optimize.OccurenceOrderPlugin())
19 , new webpack.LoaderOptionsPlugin(ifProduction(
20 {
21 minimize: true
22 , debug: false
23 }
24 , {
25 debug: true
26 }
27 ))
28 , ifProduction(new webpack.optimize.UglifyJsPlugin(UglifierSettings))
29 , ifProduction(new CompressionPlugin({
30 asset: '[path].gz[query]',
31 algorithm: 'gzip',
32 test: /\.js$/
33 }))
34 , ifDevelopment(new webpack.HotModuleReplacementPlugin())
35 ]
36};
\No newline at end of file