-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
52 lines (50 loc) · 1.08 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
const isPro = process.env.NODE_ENV == 'production'
const webpack = require('webpack')
const path = require('path')
const plugins = []
if(isPro){
plugins.push(new webpack.optimize.UglifyJsPlugin({
beautify: false,
comments: false,
compress: {
warnings: false,
drop_console: true,
collapse_vars: true,
reduce_vars: true
}
}))
}
module.exports = {
entry: {
main: ['./src/entry.js']
},
output: {
filename: '[name].js',
chunkFilename: '[name].js?[chunkhash:10]',
path: path.resolve(__dirname+'/dist'),
publicPath: './dist/'
},
module: {
rules: [
{
test: /\.css$/,
loader: "style!css"
},
{
test: /\.js$/,
loader: 'babel-loader',
options: {
presets: ['es2015'],
plugins: ["transform-object-assign"]
},
include: path.resolve(__dirname, 'src')
}
]
},
plugins,
resolve: {
extensions: ['.js', '.vue', '.jsx'],
modules: [path.resolve(__dirname, 'node_modules')]
},
devtool: 'source-map'
}