-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
131 lines (129 loc) · 3.39 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
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
125
126
127
128
129
130
131
import { resolve } from "node:path";
import { UtilsResolver } from "@bernankez/utils/resolver";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import UnoCSS from "unocss/vite";
import AutoImport from "unplugin-auto-import/vite";
import { NaiveUiResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
import Markdown from "unplugin-vue-markdown/vite";
import { transformLazyShow } from "v-lazy-show";
import { defineConfig } from "vite";
import FontCarrier, { numberChars } from "vite-plugin-font-carrier";
import { VitePWA } from "vite-plugin-pwa";
import VueDevTools from "vite-plugin-vue-devtools";
function createFontCarrier() {
return FontCarrier({
fonts: [
{
path: "./src/assets/font/Kenney-Mini-Square.ttf",
input: numberChars,
},
],
type: "woff2",
});
}
// https://vitejs.dev/config/
export default defineConfig(() => {
return {
plugins: [
vue({
include: [/\.vue$/, /\.tsx$/, /\.md$/],
template: {
compilerOptions: {
nodeTransforms: [
transformLazyShow,
],
},
},
}),
vueJsx(),
UnoCSS(),
Markdown({
markdownItOptions: {
html: true,
linkify: true,
typographer: true,
},
}),
AutoImport({
imports: [
"vue",
"vue-i18n",
"vue-router",
"@vueuse/core",
"pinia",
{
"naive-ui": [
"useDialog",
"useMessage",
"useNotification",
"useLoadingBar",
],
},
],
dirs: ["./src/composables/**", "./src/store/**"],
vueTemplate: true,
resolvers: [UtilsResolver()],
}),
Components({
dirs: ["./src/components/**"],
resolvers: [NaiveUiResolver()],
}),
createFontCarrier(),
VitePWA({
registerType: "autoUpdate",
includeAssets: ["favicon.ico", "apple-touch-icon.png", "masked-icon.svg"],
manifest: {
name: "BilibliFans",
short_name: "BilibliFans",
description: "A tool making bilibili fans card",
theme_color: "#18a058",
background_color: "#ffffff",
display: "standalone",
icons: [
{
src: "/favicon-32x32.png",
sizes: "32x32",
type: "image/png",
},
{
src: "/android-chrome-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "/android-chrome-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
{
src: "/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
workbox: {
globPatterns: ["**/*.{js,css,html,png,jpg,svg,ttf,woff2}"],
},
devOptions: {
enabled: true,
},
}),
VueDevTools(),
],
worker: {
format: "es" as const,
plugins: () => [createFontCarrier()],
},
resolve: {
alias: {
"@": resolve(__dirname, "src"),
"~": resolve(__dirname, "."),
},
},
};
});