This repository has been archived by the owner on Nov 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.config.prod.js
executable file
·75 lines (70 loc) · 1.97 KB
/
webpack.config.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'use strict';
var path = require('path');
var webpack = require('webpack');
var ENV = {
__BUILD__ : {
PRODUCTION : JSON.stringify(true),
DEVELOP : JSON.stringify(false),
STAGING : JSON.stringify(false),
BASE_URL : JSON.stringify("https://archivers.co"),
API_URL : JSON.stringify("https://archivers.co"),
USERS_API_URL : JSON.stringify("https://ident.archivers.space"),
COVERAGE_API_URL : JSON.stringify("https://coverage.archivers.space"),
WEBSOCKET_URL : JSON.stringify("wss://archivers.co/ws"),
STATIC_ASSETS_URL : JSON.stringify("http://archivers.co"),
// SEGMENT_KEY : JSON.stringify("FwUGnmKzryJpDpApVzdQy9rmwwWSiK1M"),
SEGMENT_KEY : JSON.stringify(""),
SEGMENT_APP_PROPERTIES: JSON.stringify('{ "app_version": "2.0.0beta1" }'),
}
};
function exitOneFail() {
this.plugin("done", function(stats) {
if (stats.compilation.errors && stats.compilation.errors.length) {
console.log(stats.compilation.errors);
process.exit(1);
}
});
}
module.exports = {
devtool : 'cheap-module-source-map',
entry: {
'app' : './src/js/index.js',
'vendor' : [ 'react', 'react-dom' ]
},
output: {
path: path.join(__dirname, 'dist'),
publicPath : "https://s3.amazonaws.com/static.qri.io/js/archivers/co/",
filename: '[name].min.js',
chunkFilename: "[name].chunk.min.js"
},
plugins: [
// new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin(ENV),
new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }),
exitOneFail,
new webpack.optimize.UglifyJsPlugin({minimize: true}),
],
module: {
rules: [
{
test: /\.js?$/,
loaders: ['babel-loader'],
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: [
"style-loader",
"css-loader",
"sass-loader"
]
},
{
test: /\.css$/,
use: [
"css-loader",
]
}
]
}
};