-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.babel.js
More file actions
51 lines (46 loc) · 1.35 KB
/
webpack.config.babel.js
File metadata and controls
51 lines (46 loc) · 1.35 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
import path from 'path';
import webpack from 'webpack';
import glob from 'glob';
import config from './gulp/config';
const globString = config.files.source.js;
const entries = glob.sync(globString).reduce((acc, file) => {
const basename = path.basename(file).split('.').slice(0, -1).join('.');
return {
...acc,
[basename]: [
config.hot && 'webpack-hot-middleware/client?reload=true',
file,
].filter(Boolean),
};
}, {});
export default {
entry: {
...entries,
},
output: {
path: config.files.dest.index,
filename: '[name].js',
publicPath: '/',
},
plugins: [
config.hot && new webpack.optimize.OccurrenceOrderPlugin(),
config.hot && new webpack.HotModuleReplacementPlugin(),
config.hot && new webpack.NoEmitOnErrorsPlugin(),
config.production && new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: { screw_ie8 : true }, // eslint-disable-line key-spacing
compress: { screw_ie8: true, warnings: false },
comments: false,
}),
].filter(Boolean),
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
},
devtool: 'source-map',
};