-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
executable file
·51 lines (48 loc) · 1.67 KB
/
webpack.prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
var commonConfig = require('./webpack.config.js');
var path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
module.exports = webpackMerge(commonConfig, {
// devtool: 'source-map',
mode: 'production',
output: {
path: path.join(process.cwd(), '/dist'),
publicPath: 'http://themes.potenzaglobalsolutions.com/html/webmin-react-js-admin-dashboard-template/light/',
filename: 'index_bundle.js'
},
optimization: {
minimizer: [
// we specify a custom UglifyJsPlugin here to get source maps in production
new UglifyJsPlugin({
uglifyOptions: {
mangle: {
keep_fnames: true,
},
},
})
]
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new ExtractTextPlugin('[name].css'),
new OptimizeCssAssetsPlugin({
cssProcessor: require('cssnano'),
cssProcessorOptions: {
safe: true,
discardUnused: false, // no remove @font-face
reduceIdents: false, // no change on @keyframes names
zindex: false // no change z-index
},
canPrint: true
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
],
});