-
Notifications
You must be signed in to change notification settings - Fork 39
/
webpack.config.js
55 lines (52 loc) · 1.14 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 fs = require('fs');
var webpack = require('webpack');
var babelrc = fs.readFileSync('./.babelrc');
var babelLoaderQuery = JSON.parse(babelrc);
var plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'production')
}
})
];
if (process.env.NODE_ENV !== 'development') {
plugins.push(new webpack.optimize.UglifyJsPlugin());
}
module.exports = {
context: __dirname,
entry: [
'./examples/src/main.js',
'./examples/src/main.css'
],
resolve: {
modulesDirectories: [
'node_modules',
'examples'
],
extensions: ['', '.json', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel-loader?' + JSON.stringify(babelLoaderQuery)]
},
{
test: /\.css?$/,
exclude: /node_modules/,
loader: 'style!css?modules&importLoaders=1'
},
{
test: /\.css?$/,
include: /node_modules/,
loader: 'style!css'
}
]
},
output: {
filename: 'build.js',
path: __dirname + '/examples'
},
plugins: plugins
};