-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprod.config.js
49 lines (40 loc) · 1.06 KB
/
prod.config.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
/* eslint strict: 0 */
'use strict';
const webpack = require('webpack');
const baseConfig = require('./webpack.config')
const path = require('path');
const glob = require('glob');
const deepcopy = require('deepcopy');
let entries = {};
let g = new glob.Glob('./src/js/entries/**/*.js', {
sync: true
});
g.found.forEach(function (file) {
let outputFile = file.replace('./src/js/entries/', '').replace('.js', '');
entries[outputFile] = path.resolve(__dirname, file);
});
// Dont mutate Base Config
const prodConfig = deepcopy(baseConfig);
prodConfig.devtool = 'source-map';
prodConfig.entry = entries;
prodConfig.plugins.push(
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
},
__CLIENT__: true,
__SERVER__: false,
__DEVELOPMENT__: false,
__DEVTOOLS__: false
}),
// optimizations
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
);
module.exports = prodConfig;