-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.development.js
67 lines (66 loc) · 1.85 KB
/
webpack.development.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
var path = require('path'),
webpack = require('webpack');
module.exports = {
devtool: 'source-map',
entry: {
index: [
'react-hot-loader/patch',
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./src/scripts/index.js'
]
},
//proxy
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8081',
secure: false
}
}
},
output: {
filename: 'scripts/[name].js',
path: path.join(__dirname, 'dist'),
publicPath: '/develop/'
},
resolve: {
root: path.join(__dirname, 'src'),
extensions: ['', '.jsx', '.js']
},
module: {
loaders: [{
test: /\.(js|jsx)?$/,
loader: 'babel',
include: path.join(__dirname, 'src/scripts'),
exclude: path.join(__dirname, 'src/config')
}, {
test: /\.css$/,
loader: 'style!css'
}, {
test: /\.(jpg|png|jpeg|bmp|gif)$/,
loader: 'url-loader?limit=10240&name=images/[name].[ext]'
}, {
test: /\.(svg|woff|ttf|eot)$/,
loader: 'url-loader?limit=10240&name=fonts/[name].[ext]'
}]
},
babel: {
presets: ['react', 'es2015', 'stage-0'],
plugins: ['react-hot-loader/babel', ['import', {
libraryName: 'antd',
style: 'css'
}]]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('scripts/common.js'),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
}),
new webpack.ProvidePlugin({
Promise: 'imports?this=>global!exports?global.Promise!es6-promise'
}) //promise polyfill
]
}