-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
116 lines (114 loc) · 3.15 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// const { dependencies } = require('package.json')
// let whiteListedModules = ["@supermap/iclient-leaflet"]
// const zlib = require('zlib');
const LodashModuleReplacementPlugin = require("lodash-webpack-plugin");
// const FileManagerPlugin = require('filemanager-webpack-plugin');
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "/GridUniverse/" : "/",
transpileDependencies: [
'vue-echarts',
'resize-detector',
'vuetify'
],
chainWebpack: config => {
config.plugin("loadshReplace").use(new LodashModuleReplacementPlugin({
'shorthands': true
}));
config.module
.rule('images')
.use('image-webpack-loader')
.loader('image-webpack-loader')
.options({
bypassOnDebug: true
})
.end()
},
configureWebpack: {
// Configuration applied to all builds
mode: "production",
// plugins: [
// new FileManagerPlugin({
// events: {
// onEnd: {
// copy: [{ source: './resources/neutralino.js', destination: './resources/js/neutralino.js' }]
// }
// }
// }),
// ],
optimization: {
splitChunks: {
// chunks: 'all'
cacheGroups: {
vendor: {//第三方库抽离
chunks: 'all',
test: /node_modules/,
name: 'vendor',
minChunks: 1,//在分割之前,这个代码块最小应该被引用的次数
maxInitialRequests: 5,
minSize: 0,//大于 0 个字节
priority: 100//权重
},
common: { //公用模块抽离
chunks: 'all',
test: /[\\/]src[\\/]js[\\/]/,
name: 'common',
minChunks: 2, //在分割之前,这个代码块最小应该被引用的次数
maxInitialRequests: 5,
minSize: 0,//大于 0 个字节
priority: 60
},
styles: { //样式抽离
name: 'styles',
test: /\.(sa|sc|c)ss$/,
chunks: 'all',
enforce: true
},
runtimeChunk: {
name: 'manifest'
}
}
},
nodeEnv: 'production',
minimize: true
},
// module: {
// rules: [
// {
// test: /\.js$/,
// loader: "webpack-remove-debug",
// }
// ]
// },
externals: [
...Object.keys({}).filter(d => !whiteListedModules.includes(d))],
},
pluginOptions: {
// electronBuilder: {
// nodeIntegration: true,
// contextIsolation: false,
// chainWebpackRendererProcess(config) {
// config.plugins.delete('workbox')
// config.plugins.delete('pwa')
// },
// builderOptions: {
// win: {
// 'signAndEditExecutable': false,
// "icon": "src/assets/grid.ico",
// target: [
// 'portable'
// ]
// },
// portable: {
// artifactName: '${name}-${version}.exe'
// },
// extraFiles: [
// {
// "from": "pydist",
// "to": "resources/pydist",
// "filter": ["**/*"]
// }
// ]
// }
// }
}
}