-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathwebpack.config.prod.js
73 lines (69 loc) · 1.96 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
/* eslint-disable */
var path = require('path');
var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var rootPath = path.join(__dirname, './');
var env = process.env.NODE_ENV || 'development';
module.exports = {
devtool: 'source-map',
devServer: {
headers: { 'Access-Control-Allow-Origin': '*' },
noInfo: true,
// Configuration in case you need to proxy calls to an api
proxy: {
"/api/*": "http://localhost:5000"
},
contentBase: "./build/dev_build"
},
stats: {
colors: true
},
entry: {
app: [
'app/index.jsx'
].filter(Boolean)
},
output: {
path: "build/prod_build",
filename: "[name].js",
},
module: {
loaders: [
{
test: /\.jsx?$/,
include: [path.join(rootPath, 'app')],
exclude: /node_modules/,
loader: 'babel',
query: undefined
},
{ test: /\.css$/, loader: "style!css?modules" },
{ test: /\.styl$/, loader: "style!css?modules!stylus" },
{ test: /\.png/, loader: "file-loader?mimetype=image/png" },
{ test: /\.jpg/, loader: "file" },
{ test: /\.gif/, loader: "file" },
{ test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader?mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
]
},
resolve: {
root: rootPath,
extensions: ['', '.js', '.jsx', '.json', '.css', '.styl']
},
plugins: [
// Prevent showing lint errors
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new WebpackNotifierPlugin(),
new HtmlWebpackPlugin({
template: "app/assets/index.template.html"
}),
new webpack.DefinePlugin({
'process.env': {
// Useful to reduce the size of client-side libraries, e.g. react
NODE_ENV: JSON.stringify(env)
}
}),
].filter(Boolean)
};
/* eslint-enable */