forked from bananaoomarang/isomorphic-redux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
58 lines (53 loc) · 1.36 KB
/
webpack.dev.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
import webpack from 'webpack';
import assign from 'object-assign';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import prodCfg from './webpack.prod.config.js';
Object.assign = assign;
const BABEL_QUERY = {
presets: ['react', 'es2015'],
plugins: [
['transform-object-rest-spread'],
['transform-class-properties'],
['transform-decorators-legacy'],
[
'react-transform',
{
transforms: [
{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module']
}
]
}
]
]
}
export default function(app) {
const config = Object.assign(prodCfg, {
devtool: 'inline-source-map',
entry: [
'webpack-hot-middleware/client',
'./client'
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: BABEL_QUERY
}
]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
});
const compiler = webpack(config);
app.use(webpackDevMiddleware(compiler, { noInfo: true }));
app.use(webpackHotMiddleware(compiler));
}