-
Notifications
You must be signed in to change notification settings - Fork 14
/
vite.config.ts
69 lines (67 loc) · 1.83 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
import path from 'node:path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import UnoCSS from 'unocss/vite'
import Markdown from 'unplugin-vue-markdown/vite'
import Inspect from 'vite-plugin-inspect'
import { VitePWA } from 'vite-plugin-pwa'
import VueDevTools from 'vite-plugin-vue-devtools'
const pathSrc = path.resolve(__dirname, 'src')
export default defineConfig({
plugins: [
Vue({
include: [/\.vue$/, /\.md$/],
}),
Markdown({}),
Components({
dts: path.resolve(pathSrc, 'typings/components.d.ts'),
}),
AutoImport({
imports: ['vue', 'vue-router', '@vueuse/core'],
dirs: [path.resolve(pathSrc, 'composables')],
vueTemplate: true,
dts: path.resolve(pathSrc, 'typings/auto-import.d.ts'),
}),
UnoCSS(),
Inspect(),
VitePWA({
manifest: {
name: '开源面对面',
short_name: 'osf2f',
description: '开源面对面,连接热爱开源的你!',
id: 'net.osf2f',
theme_color: '#b7dca7',
icons: [
{
src: '/pwa/logo_200x200.png',
sizes: '200x200',
type: 'image/png',
},
{
src: '/pwa/logo.ico',
sizes: '256x170',
type: 'image/x-icon',
},
],
},
devOptions: {
enabled: false,
},
registerType: 'autoUpdate',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,jpg,svg,ico}'],
runtimeCaching: [
{
urlPattern: ({ url }) => url.origin === 'https://img.shields.io',
method: 'GET',
handler: 'NetworkFirst',
},
],
clientsClaim: true,
},
}),
VueDevTools(),
],
})