-
Notifications
You must be signed in to change notification settings - Fork 68
/
webpack4.config.js
65 lines (63 loc) · 1.43 KB
/
webpack4.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
58
59
60
61
62
63
64
65
// config for webpack 4.x
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const PROD = process.env.NODE_ENV === 'production'
const MODE = PROD ? 'production' : 'development'
const optimizationConf = PROD ? {
minimizer: [
new UglifyJSPlugin({
uglifyOptions: {
warning: 'verbose',
ecma: 6,
beautify: false,
compress: false,
comments: false,
mangle: false,
toplevel: false,
keep_classnames: true,
keep_fnames: true
}
})
]
} : {}
module.exports = {
mode: MODE,
entry: path.join(__dirname, '/src/FlipCountdown.vue'),
output: {
path: path.join(__dirname, '/dist/'),
filename: 'vue2-flip-countdown.js',
libraryTarget: 'umd',
library: 'vue2-flip-countdown',
umdNamedDefine: true,
globalObject: 'typeof self !== \'undefined\' ? self : this'
},
optimization: optimizationConf,
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
js: {
loader: 'babel-loader',
options: { presets: ['env'] }
}
}
}
},
{
test: /\.less$/,
use: [
'vue-style-loader',
'css-loader',
'less-loader'
]
}
]
},
plugins: [
new VueLoaderPlugin()
]
}