This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
109 lines (102 loc) · 3.41 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
const BundleTracker = require("webpack-bundle-tracker"); // eslint-disable-line
const CompressionPlugin = require('compression-webpack-plugin'); // eslint-disable-line
const path = require('path'); // eslint-disable-line
const pages = {
login: {
title: '😀',
entry: './resources/ts/login.ts',
chunks: [ 'chunk-vendors', 'chunk-common', 'chunk-login-vendors', 'chunk-vuetify', 'login']
},
admin: {
title: '😀',
entry: './resources/ts/admin.ts',
chunks: [ 'chunk-vendors', 'chunk-common', 'chunk-admin-vendors','chunk-vuetify', 'admin']
},
maintenance: {
title: '😀',
entry: './resources/ts/maintenance.ts',
chunks: [ 'chunk-vendors', 'chunk-common', 'chunk-maintenance-vendors','chunk-vuetify', 'maintenance']
},
user: {
title: '😀',
entry: './resources/ts/user.ts',
chunks: [ 'chunk-vendors', 'chunk-common', 'chunk-user-vendors','chunk-vuetify', 'user']
},
};
module.exports = {
pages: pages,
publicPath: '/vue',
outputDir: './public/vue',
css: {
extract: { ignoreOrder: true }
},
transpileDependencies: [
'vuetify'
],
configureWebpack: {
plugins: [
new BundleTracker({ filename: 'webpack-stats.json' }),
new CompressionPlugin(),
// new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)({ analyzerMode: 'static' }),
],
},
pwa: {
workboxPluginMode: 'GenerateSW',
manifestOptions: {
start_url: '/',
},
name: 'Mass',
themeColor: '#4DBA87',
msTileColor: '#000000',
appleMobileWebAppCapable: true,
appleMobileWebAppStatusBarStyle: 'default',
},
chainWebpack: config => {
config.module
.rule('eslint')
.use('eslint-loader')
.options({
fix: process.env.NODE_ENV !== 'production',
});
const options = module.exports;
const pages = options.pages;
const pageKeys = Object.keys(pages);
config.resolve
.alias
.set('@', path.resolve(__dirname, 'resources/ts'))
.set('@style', path.resolve(__dirname, 'resources/styles'))
.set('@module', path.resolve(__dirname, 'node_modules'));
config.performance
.maxEntrypointSize(1000000)
.maxAssetSize(1000000);
// Long-term caching
const IS_VENDOR = /[\\/]node_modules[\\/]/;
const IS_VUETIFY = /[\\/]node_modules[\\/]vuetify/;
config.optimization.splitChunks({
cacheGroups: {
vuetify: {
name: 'chunk-vuetify',
priority: -1,
chunks: 'all',
test: IS_VUETIFY,
enforce: true
},
...pageKeys.map((key) => ({
name: `chunk-${key}-vendors`,
priority: -11,
chunks: (chunk) => chunk.name === key,
test: IS_VENDOR,
enforce: true
})),
common: {
name: 'chunk-common',
priority: -20,
chunks: 'initial',
minChunks: 2,
reuseExistingChunk: true,
enforce: true
}
}
});
}
};