-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.js
44 lines (41 loc) · 1.16 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
var webpack = require('webpack');
var path = require('path');
var bower_dir = path.join(__dirname, 'bower_components');
var node_modules_dir = path.join(__dirname, 'node_modules');
var config = {
addVendor: function (name, path) {
this.resolve.alias[name] = path;
this.module.noParse.push(path);
},
context: __dirname,
entry: {
app: process.env.NODE_ENV === 'production' ? ['./app/main.js'] : ['webpack/hot/dev-server', './app/main.js']
},
output: {
publicPath: '/',
path: path.resolve(__dirname, process.env.NODE_ENV === 'production' ? './dist/' : './build'),
filename: 'bundle.js'
},
resolve: {
alias: {}
},
module: {
noParse: [],
loaders: [{
test: /\.js$/,
loader: 'jsx-loader',
exclude: [bower_dir, node_modules_dir]
}, {
test: /\.css$/,
loader: 'style-loader!css-loader'
}, {
test: /\.(woff|png)$/,
loader: 'url-loader?limit=100000'
}]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('app', null, false)
]
};
config.addVendor('react', path.resolve(bower_dir, 'react/react.min.js'));
module.exports = config;