-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
46 lines (46 loc) · 1.12 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
var webpack = require('webpack');
var path = require('path');
var pkg = require('./package.json');
var hots = [path.join(__dirname, 'src'), path.join(__dirname, 'demo')];
if (pkg.dependencies)
for (var pack in pkg.dependencies) {
/^react-/.test(pack) && hots.push(path.join(__dirname, 'node_modules', pack));
}
module.exports = {
entry: {
demo: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./demo/demo'
]
},
output: {
path: path.join(__dirname, '/'),
filename: '[name].entry.js',
publicPath: '/'
},
resolve: {
modulesDirectories: ['node_modules', './src'],
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'react-hot!babel',
include: hots
}, {
test: /\.less$/,
loader: 'style!css!autoprefixer!less'
}, {
test: /\.css$/,
loader: 'style!css!autoprefixer'
}, {
test: /\.(ttf|eot|svg|png|woff(2)?)(\?[a-z0-9]+)?$/,
loader: 'file'
}]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};