This repository has been archived by the owner on Apr 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
124 lines (119 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
117
118
119
120
121
122
123
124
const path = require('path');
const MomentLocalesPlugin = require("moment-locales-webpack-plugin");
const VuetifyLoaderPlugin = require("vuetify-loader/lib/plugin");
const WebpackPwaManifest = require('webpack-pwa-manifest')
process.env.VUE_APP_BUILD_DATE = new Date().toISOString();
module.exports = {
chainWebpack: (config) => {
config.plugin("VuetifyLoaderPlugin").tap((args) => {
return [
{
match(originalTag, { kebabTag, camelTag, path, component }) {
if (kebabTag.startsWith("hive-")) {
return [
camelTag,
`import ${camelTag} from '@/components/${camelTag.substring(
4
)}.vue'`,
];
}
},
},
];
});
},
configureWebpack: {
plugins: [
new MomentLocalesPlugin(),
new WebpackPwaManifest({
name: "Hive Stats and Leaderboards",
short_name: "Hive Stats",
description:
"Hive Stats, Leaderboards, Maps, Team changes and many things more!",
start_url: "/",
display: "standalone",
theme_color: "#4285f4",
background_color: "#4285f4",
icons: [
{
src: path.resolve("src/assets/icon.png"),
sizes: [96, 128, 192, 256, 384, 512, 1024],
},
],
}),
],
},
css: {
loaderOptions: {
sass: {
data: `@import "~@/assets/main.scss"`,
},
},
},
pwa: {
workboxOptions: {
skipWaiting: true,
navigateFallback: "/",
navigateFallbackBlacklist: [/api/],
exclude: [/api/],
runtimeCaching: [
{
urlPattern: /api/,
handler: "networkFirst",
options: {
networkTimeoutSeconds: 10,
cacheName: "hive-api-cache",
cacheableResponse: {
statuses: [0, 200, 404],
},
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24,
purgeOnQuotaError: true,
},
},
},
{
urlPattern: new RegExp("^https://crafatar.com/"),
handler: "staleWhileRevalidate",
options: {
cacheableResponse: {
statuses: [0, 200],
},
cacheName: "cravatar-cache",
expiration: {
maxEntries: 1000,
maxAgeSeconds: 60 * 60 * 24 * 30,
purgeOnQuotaError: true,
},
},
},
{
urlPattern: new RegExp("^https://api.lergin.de/"),
handler: "networkFirst",
options: {
networkTimeoutSeconds: 10,
cacheName: "lergin-api-cache",
cacheableResponse: {
statuses: [0, 200],
},
expiration: {
maxEntries: 25,
maxAgeSeconds: 60 * 60 * 24,
purgeOnQuotaError: true,
},
},
},
],
},
},
pluginOptions: {
prerenderSpa: {
registry: undefined,
renderRoutes: ["/"],
useRenderEvent: true,
headless: true,
onlyProduction: true,
},
},
};