-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathwebpack.config.js
More file actions
60 lines (55 loc) · 1.21 KB
/
webpack.config.js
File metadata and controls
60 lines (55 loc) · 1.21 KB
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
59
60
var path = require('path');
var webpack = require('webpack');
require('babel-polyfill');
var IS_PRODUCTION = process.env.NODE_ENV === 'production';
var ENTRY_POINTS = [
'./src/js/app'
];
var JS_LOADERS = [
'babel-loader?cacheDirectory&presets[]=react,presets[]=es2015,presets[]=stage-0'
];
var PLUGINS = [];
if (IS_PRODUCTION) {
// Uglify in production.
PLUGINS.push(
new webpack.optimize.UglifyJsPlugin({
mangle: {
except: ['$super', '$', 'exports', 'require']
},
sourcemap: false
})
);
}
module.exports = {
entry: ENTRY_POINTS,
output: {
// Bundle will be served at /bundle.js locally.
filename: 'bundle.js',
path: path.resolve(__dirname, './build'),
publicPath: '/',
},
module: {
loaders: [
{
// JS.
exclude: /(node_modules|bower_components|vr-markup)/,
loaders: JS_LOADERS,
test: /\.js$/,
},
{
test: /\.css$/,
loader: 'style-loader!css-loader?-svgo'
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
}
],
},
plugins: PLUGINS,
devtool: 'source-map'
};