-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
66 lines (63 loc) · 1.57 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var path = require('path');
var webpack = require('webpack');
var SRC_DIR = path.resolve(__dirname, 'src');
var SRC_DIR_MAIN_FILE = path.resolve(SRC_DIR, 'main.js');
var DIST_DIR = path.resolve(__dirname, 'dist');
var DIST_PUBLIC_DIR = path.resolve(DIST_DIR, 'public');
var DIST_PUBLIC_STATIC_DIR = path.resolve(DIST_PUBLIC_DIR, 'static');
var mode = process.env.WEBPACK_CONFIG;
module.exports = {
resolve: {
// Where webpack should take a look to find modules to 'import x fom './y'
// And what files to look for (y, y.js, y.jsx)
modulesDirectories: ['node_modules', 'src'],
extensions: ['', '.js', '.jsx']
},
entry: [
/* TODO add react-hot-loader*/
'babel-polyfill', SRC_DIR_MAIN_FILE
],
output: {
path: DIST_PUBLIC_STATIC_DIR,
filename: 'main.js',
publicPath: ''
},
module: {
loaders: [
{
test: /\.(js|jsx)?$/,
loaders: ['react-hot', 'babel-loader'],
exclude: /node_modules/
},
{
test: /\.css$/,
loader: 'style!css'
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'LOG_ENABLE': JSON.stringify(true),
'LOG_LEVEL': 3 // 0 = none; 1 = error; 2 = warn; 3 = info
})
],
devtool: 'source-map',
devServer: {
port: 4711,
inline: true,
hot: true,
publicPath: '/static/',
contentBase: DIST_PUBLIC_DIR,
stats: 'errors-only',
historyApiFallback: {
index: 'index.html'
},
proxy: {
'/api': {
target: 'http://localhost:4712',
secure: false
}
}
}
};