forked from parse-community/parse-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
production.config.js
54 lines (49 loc) · 1.32 KB
/
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
45
46
47
48
49
50
51
52
53
54
/*
* Copyright (c) 2016-present, Parse, LLC
* All rights reserved.
*
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
var configuration = require('./base.config.js');
configuration.entry = {
dashboard: './dashboard/index.js',
PIG: './parse-interface-guide/index.js',
quickstart: './quickstart/index.js',
};
configuration.output.path = './production/bundles';
var webpack = require('webpack');
// Add propType removal to Babel
var loaders = configuration.module.loaders;
for (var i = 0; i < loaders.length; i++) {
if (loaders[i].loader === 'babel-loader') {
if (!loaders[i].query.plugins) {
loaders[i].query.plugins = [];
}
loaders[i].query.plugins.push('babel-plugin-remove-proptypes');
break;
}
}
// Enable minification
configuration.plugins.push(
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin(),
function() {
this.plugin('done', function(stats) {
if (stats.compilation.errors && stats.compilation.errors.length) {
console.log(stats.compilation.errors);
process.exit(1);
}
});
}
);
module.exports = configuration;