forked from prettywhitewhite/dynamic-form-render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
82 lines (82 loc) · 1.67 KB
/
vue.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin-legacy')
const elementExternals = require('./elementUIDependencies')
const exampleConfig = {
devtool: 'eval-source-map',
optimization: {
minimize: false,
splitChunks: {
chunks: 'async',
},
},
plugins: [
new webpack.ProvidePlugin({
_: 'lodash',
}),
],
devServer: {
disableHostCheck: true,
overlay: false,
host: '0.0.0.0',
port: '80',
hot: true,
compress: true,
open: false,
},
}
const externals = {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue',
},
lodash: {
root: '_',
commonjs: 'lodash',
commonjs2: 'lodash',
amd: 'lodash',
},
axios: 'axios',
elementThemeChalk: 'element-theme-chalk',
}
elementExternals.components.forEach(function(key) {
externals[`element-ui/lib/${key}`] = `element-ui/lib/${key}`
})
const libConfig = {
optimization: {
minimize: true,
splitChunks: {
hidePathInfo: true,
minSize: 30000,
maxAsyncRequests: 5,
maxInitialRequests: 3,
},
},
plugins: [
new TerserPlugin({
terserOptions: {compress: {drop_console: true}},
}),
],
externals: externals,
}
module.exports = {
pages: {
index: {
entry: 'example/index.js',
template: 'example/index.html',
},
},
configureWebpack: () => {
const defaultConfig = {
resolve: {
alias: require('./alias.config.js').webpack,
},
}
if (process.env.NODE_ENV === 'production') {
return Object.assign(defaultConfig, libConfig)
} else {
return Object.assign(defaultConfig, exampleConfig)
}
},
}