-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
67 lines (65 loc) · 1.8 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
const path = require('path');
const devMode = process.env.NODE_ENV !== 'production';
const compressionWebpackPlugin = require('compression-webpack-plugin');
const cssMinimizerPlugin = require('css-minimizer-webpack-plugin');
function resolve(dir) {
return path.resolve(__dirname, dir)
}
module.exports = {
filenameHashing:true,
lintOnSave:false,
transpileDependencies: [
'vuetify'
],
css:{
requireModuleExtension:true,
},
productionSourceMap:false,
devServer:{
compress:true,
port:2016,
disableHostCheck:true,
hot:true,
open:true,
},
parallel:require('os').cpus().length > 1,
configureWebpack:cfg => {
if (process.env.VUE_APP_PLATFORM === 'h5' && !devMode) {
cfg.performance = {
hints:'warning',
maxEntrypointSize:20480000,
maxAssetSize:20480000,
assetFilter:function (assetFilename) {
return assetFilename.endsWith('.js');
}
};
cfg.plugins.push(new compressionWebpackPlugin({
algorithm:'gzip',
test:new RegExp('\\.(' + ['ts', 'js', 'css'].join('|') + ')$'),
threshold:10240,
minRatio:0.8
}));
cfg.optimization = {
minimize:true,
minimizer:[
new cssMinimizerPlugin(),
],
};
}
cfg.resolve.extensions = ['.ts', '.js', '.vue', '.json'];
cfg.resolve.alias = {
...cfg.resolve.alias,
'@':resolve('src'),
'assets':resolve('src/assets'),
'builds':resolve('src/builds'),
'components':resolve('src/components'),
'mixins':resolve('src/mixins'),
'pages':resolve('src/pages'),
'plugins':resolve('src/plugins'),
'projects':resolve('src/projects'),
'service':resolve('src/service'),
'static':resolve('src/static'),
'utils':resolve('src/utils'),
};
},
};