/
webpack.config.js
55 lines (53 loc) 路 1.42 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
var path = require('path')
var webpack = require('webpack')
var config = require('./config');
var ExtendedDefinePlugin = require('extended-define-webpack-plugin');
module.exports = {
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000', // WebpackDevServer host and port
'webpack/hot/only-dev-server', // 'only' prevents reload on syntax errors
'./source/app.jsx'
],
output: {
path: path.join(__dirname, 'public/js'),
filename: 'bundle.js',
publicPath: '/js/'
},
devtool: '#cheap-eval-source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|public)/,
loaders: [
'react-hot',
'babel'
]
},
{ test: /\.json$/, loader: 'json-loader'},
{ test: /\.css$/, loader: "style-loader!css-loader" }
],
noParse: [
/node_modules\/json-schema\/lib\/validate\.js/,
/node_modules\\json-schema\\lib\\validate\.js/
]
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty',
console: false,
'coffee-script': 'mock'
},
amd: { jQuery: true },
plugins: [
new ExtendedDefinePlugin({
"PUB_API_WINDOW": config.public.api.use_window_defaults,
"PUB_API_PROTO": config.public.api.protocol,
"PUB_API_HOST": config.public.api.host,
"PUB_API_PORT": config.public.api.port
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
]
}