-
Notifications
You must be signed in to change notification settings - Fork 24
/
webpack.config.js
57 lines (54 loc) · 1.62 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
56
57
const path = require('path');
const webpack = require('webpack');
const NgAnnotatePlugin = require('ng-annotate-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ENV = process.env.npm_lifecycle_event;
const isProd = ENV === 'build-js';
const config = {
devtool: isProd ? 'source-map' : 'eval-source-map',
entry: {
'app.bundle': path.join(__dirname, '/public/js/index'),
'vendor.bundle': path.join(__dirname, 'public/js/vendor/index')
},
output: {
path: path.join(__dirname, '/public/build/js'),
filename: '[name].js',
publicPath: '/build/js'
},
module: {
rules: [
{
test: /\.js?$/,
loader: 'babel-loader',
include: path.join(__dirname, '/public/js'),
exclude: [
path.join(__dirname, '/public/js/vendor')
]
},
{
test: /\.html$/,
loader: 'html-loader',
include: path.join(__dirname, '/public/js'),
options: {
minimize: false
}
}
]
},
plugins: [
new CleanWebpackPlugin([path.join(__dirname, '/public/build/js/*')], {
exclude: ['.gitkeep']
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor.bundle',
filename: 'vendor.bundle.js'
}),
new NgAnnotatePlugin({
add: true
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
})
]
};
module.exports = config;