-
Notifications
You must be signed in to change notification settings - Fork 1
/
getWebpackConfig.js
61 lines (57 loc) · 1.24 KB
/
getWebpackConfig.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
59
60
61
var path = require('path');
var webpack = require('webpack');
var _ = require('lodash');
module.exports = function(options) {
var config = {
entry: [
'./src/js/main.js'
],
output: {
path: path.join(__dirname, 'build'),
filename: 'app.js',
publicPath: '/'
},
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.DedupePlugin()
],
resolve: {
extensions: ['', '.js'],
modulesDirectories: ['src', 'node_modules']
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel?stage=0'],
include: path.join(__dirname, 'src/js')
}
]
},
};
if (options.environment === 'benchmark') {
_.assign(config, {
devtool: 'eval-cheap-module-source-map',
output: {
path: path.join(__dirname, 'build/benchmark'),
filename: 'benchmark.js',
publicPath: '/'
},
entry: [
'./benchmarks.webpack.js'
],
plugins: [
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel?stage=0'],
include: path.join(__dirname, 'src/js')
},
]
},
});
}
return config;
};