-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.config.js
44 lines (37 loc) · 1.16 KB
/
webpack.production.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
var webpack = require("webpack");
var baseWebpackConfig = require("./frontend_build/baseWebpackConfig");
var productionWebpackConfig = baseWebpackConfig;
var publicPath = "/webpack-dist-optimized/"
var yaml = require('js-yaml');
var fs = require('fs');
try {
var doc = yaml.safeLoad(fs.readFileSync(__dirname + '/config/canvas_cdn.yml', 'utf8'));
var cdnHost = doc.production.host
if(cdnHost !== undefined && cdnHost !== null){
publicPath = cdnHost + "/dist" + publicPath;
console.log(publicPath);
}else{
console.log("NO CDN HOST, USING LOCAL ASSETS");
}
} catch (e) {
console.log("NO CDN FILE, USING LOCAL ASSETS");
}
productionWebpackConfig.devtool = 'cheap-source-map';
productionWebpackConfig.output.path = __dirname + '/public/webpack-dist-optimized';
productionWebpackConfig.output.publicPath = publicPath;
if (!process.env.JS_BUILD_NO_UGLIFY) {
productionWebpackConfig.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true,
warnings: true
},
mangle: {
screw_ie8: true
},
output: {
comments: false,
screw_ie8: true
}
}));
}
module.exports = productionWebpackConfig;