-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
84 lines (82 loc) · 2.22 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
import { defineConfig, loadEnv } from 'vite'
import tsconfigPaths from 'vite-tsconfig-paths'
import Vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Markdown from 'vite-plugin-vue-markdown'
import Components from 'unplugin-vue-components/vite'
import Pages from 'vite-plugin-pages'
import generateSitemap from 'vite-plugin-pages-sitemap'
import Layouts from 'vite-plugin-vue-layouts'
import Unocss from 'unocss/vite'
import type { ManifestOptions } from 'vite-plugin-pwa'
import { VitePWA as PWA } from 'vite-plugin-pwa'
import { chunkSplitPlugin as ChunkSplit } from 'vite-plugin-chunk-split'
const manifest: Partial<ManifestOptions> = {
name: 'BooCat',
// eslint-disable-next-line camelcase
short_name: 'BooCat',
description: 'A book search engine',
// eslint-disable-next-line camelcase
theme_color: '#ffffff',
icons: [
{
src: 'android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'any maskable',
},
{
src: 'android-chrome-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable',
},
],
}
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
server: {
proxy: {
'/api': {
target: env.endpoint,
changeOrigin: true,
},
},
},
plugins: [
tsconfigPaths({ loose: true }),
Vue({
include: [/\.vue$/, /\.md$/],
reactivityTransform: true,
}),
AutoImport({
vueTemplate: true,
imports: ['vue', 'vue/macros'],
dts: 'src/types/auto-imports.d.ts',
dirs: ['src/composables'],
}),
Markdown({ wrapperClasses: 'prose m-auto' }),
Components({
extensions: ['vue', 'md'],
dts: 'src/types/components.d.ts',
}),
Pages({
extensions: ['vue', 'md'],
onRoutesGenerated: routes => generateSitemap({
routes,
hostname: 'https://boocat.org',
}),
}),
Layouts(),
Unocss(),
ChunkSplit(),
PWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
devOptions: { enabled: true },
manifest,
}),
],
}
})