-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwebpack.config.js
43 lines (38 loc) · 976 Bytes
/
webpack.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
var path = require('path')
var webpack = require('webpack')
var publicPath = 'http://localhost:4001/'
var env = process.env.MIX_ENV || 'dev'
var prod = env === 'prod'
var entry = './web/static/js/app.js'
var hot = 'webpack-hot-middleware/client?path=' +
publicPath + '__webpack_hmr'
var plugins = [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
__PROD: prod,
__DEV: env === 'dev'
})
]
if (env === 'dev') {
plugins.push(new webpack.HotModuleReplacementPlugin())
}
module.exports = {
devtool: prod ? null : 'cheap-module-eval-source-map',
entry: prod ? entry : [hot, entry],
output: {
path: path.resolve(__dirname) + '/priv/static/js',
filename: 'index.bundle.js',
publicPath: publicPath
},
plugins: plugins,
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel'],
exclude: path.resolve(__dirname, 'node_modules')
}
]
}
}