forked from bridge-core/editor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
98 lines (96 loc) · 2.35 KB
/
vite.config.ts
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
import { defineConfig } from 'vite'
import { resolve, join } from 'path'
import { createVuePlugin } from 'vite-plugin-vue2'
import { VitePWA } from 'vite-plugin-pwa'
const isNightly = process.argv[2] === '--nightly'
const iconPath = (filePath: string) =>
isNightly ? `./img/icons/nightly/${filePath}` : `./img/icons/${filePath}`
// https://vitejs.dev/config/
export default defineConfig({
base: '/',
server: {
port: 8080,
},
resolve: {
alias: {
'/@': join(__dirname, 'src'),
vue: 'vue/dist/vue.esm.js',
molangjs: join(__dirname, './src/utils/MoLangJS.ts'),
},
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
// nested: resolve(__dirname, 'nested/index.html'),
},
},
},
plugins: [
createVuePlugin(),
VitePWA({
filename: 'service-worker.js',
registerType: 'prompt',
includeAssets: [
iconPath('favicon.svg'),
iconPath('favicon-16x16.png'),
iconPath('favicon-32x32.png'),
],
workbox: {
maximumFileSizeToCacheInBytes: Number.MAX_SAFE_INTEGER,
},
manifest: {
name: isNightly ? 'bridge Nightly' : 'bridge v2',
short_name: isNightly ? 'bridge Nightly' : 'bridge v2',
theme_color: '#1778D2',
icons: [
{
src: iconPath('android-chrome-192x192.png'),
sizes: '192x192',
type: 'image/png',
},
{
src: iconPath('android-chrome-512x512.png'),
sizes: '512x512',
type: 'image/png',
},
{
src: iconPath('android-chrome-maskable-192x192.png'),
sizes: '192x192',
type: 'image/png',
purpose: 'maskable',
},
{
src: iconPath('android-chrome-maskable-512x512.png'),
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
start_url: '.',
display: 'standalone',
background_color: '#0F0F0F',
// @ts-ignore
capture_links: ['existing-client-navigate'],
file_handlers: [
{
action: '/',
accept: {
'application/zip': [
'.mcaddon',
'.mcpack',
'.mcworld',
'.mctemplate',
],
'application/json': ['.json', '.bbmodel'],
'application/javascript': ['.js', '.ts'],
'text/plain': ['.mcfunction', '.molang', '.lang'],
'image/*': ['.tga', '.png', '.jpg', '.jpeg'],
},
},
],
display_override: ['window-controls-overlay', 'standalone'],
},
}),
],
})