-
Notifications
You must be signed in to change notification settings - Fork 59
/
webpack.dev.config.js
88 lines (70 loc) · 1.72 KB
/
webpack.dev.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
'use strict';
var path = require('path');
var webpack = require('webpack');
var config = require('./webpack.base.config.js');
var update = require('react/lib/update');
var ExportFilesWebpackPlugin = require('export-files-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
if (process.env.NODE_ENV !== 'test') {
config = update(config, {
entry: {
$set: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/dev-server',
'./client/entry'
]
}
});
}
config = update(config, {
debug: { $set: true },
profile: { $set: true },
devtool: { $set: 'eval-source-map' },
output: {
$set: {
path: path.join(process.cwd(), '/dev/static/scripts'),
pathInfo: true,
publicPath: 'http://localhost:3000/static/scripts/',
filename: 'main.js'
}
},
plugins: {
$push: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
inject: true,
filename: 'dev/index.html',
template: 'client/views/index.tpl'
}),
new ExportFilesWebpackPlugin('dev/index.html')
]
},
module: {
loaders: {
$push: [
{ test: /\.jsx?$/, loaders: [ 'babel' ], exclude: /node_modules/ }
]
}
},
devServer: {
$set: {
publicPath: '/static/scripts/',
port: 3000,
contentBase: './dev',
inline: true,
hot: true,
stats: {
colors: true
},
historyApiFallback: true,
headers: {
'Access-Control-Allow-Origin': 'http://localhost:3001',
'Access-Control-Allow-Headers': 'X-Requested-With'
},
proxy: {
'/api/*': 'http://localhost:3001'
}
}
}
});
module.exports = config;