forked from jason5ng32/MyIP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
80 lines (77 loc) · 1.74 KB
/
vite.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
import dotenv from 'dotenv';
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { VitePWA } from 'vite-plugin-pwa'
dotenv.config();
const apiPort = process.env.PORT || 11966;
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag === 'pwa-install'
}
}
}),
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
workbox: {
globPatterns: [
'**/*.{js,css,html,woff,woff2}',
'*.{js,css,html,png,svg,jpg,webp}',
]
},
manifest: {
name: 'IPCheck.ing',
short_name: 'IPCheck.ing',
theme_color: '#f8f9fa',
orientation: "portrait",
id: 'com.jasonng.myip',
description: 'All in one IP Toolbox',
icons: [
{
src: '/logo-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/logo-512.png',
sizes: '512x512',
type: 'image/png',
},
],
},
}),
],
resolve: {
alias: {
'@': '/src',
},
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
return 'vendor';
}
},
assetFileNames: (assetInfo) => {
if (assetInfo.name.endsWith('.woff') || assetInfo.name.endsWith('.woff2')) {
return 'fonts/[name][extname]';
}
return 'assets/[name]-[hash][extname]';
},
}
},
chunkSizeWarningLimit: 1000,
},
server: {
host: '0.0.0.0',
port: 18966,
proxy: {
'/api': `http://localhost:${apiPort}`
}
}
})