-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.local.config.js
45 lines (39 loc) · 1.11 KB
/
webpack.local.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
var path = require("path")
var webpack = require('webpack')
var BundleTracker = require('webpack-bundle-tracker')
var config = require('./webpack.base.config.js')
// Use webpack dev server
config.entry = {
main:
['webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/assets/js/main/index'
]
,
login:
['webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/assets/js/login/index'
]
}
// override django's STATIC_URL for webpack bundles
config.output.publicPath = 'http://localhost:3000/assets/bundles/'
// Add HotModuleReplacementPlugin and BundleTracker plugins
config.plugins = config.plugins.concat([
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new BundleTracker({filename: './webpack-stats.json'}),
])
// Add a loader for JSX files with react-hot enabled
config.module.rules.push(
{
test: /\.jsx?$/,
exclude: /node_modules/,
use:
[
'react-hot-loader',
'babel-loader?presets[]=react'
]
}
)
module.exports = config