-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
121 lines (111 loc) · 2.65 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
import { PluginOption, defineConfig } from "vite";
import Vue from "@vitejs/plugin-vue";
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
import Pages from "vite-plugin-pages";
import Components from "unplugin-vue-components/vite";
import Layouts from "vite-plugin-vue-layouts";
import SvgLoader from "vite-svg-loader";
import path from "path";
import { FileSystemIconLoader } from "unplugin-icons/loaders";
import Icons from "unplugin-icons/vite";
import IconsResolver from "unplugin-icons/resolver";
import { VitePWA } from "vite-plugin-pwa";
const SILENT = Boolean(process.env.SILENT) ?? false;
interface ExtendedIconResource {
src: string;
type: string;
sizes?: string;
purpose?: string;
media?: string;
}
// https://vitejs.dev/config/
export default defineConfig({
root: process.cwd(),
base: "/",
publicDir: "public",
logLevel: SILENT ? "error" : "info",
optimizeDeps: {
include: ["@vueuse/core", "@vueuse/head", "vue-i18n", "moment"],
},
resolve: {
alias: [
{
find: "/~/",
replacement: `/src/assets/`,
},
{
find: "/@src/",
replacement: `/src/`,
},
],
},
plugins: [
Vue({
include: [/\.vue$/],
template: {
compilerOptions: {},
},
}),
VueI18nPlugin({
include: [path.resolve(__dirname, "./src/locales/**")],
strictMessage: false,
}),
Pages({
pagesDir: [
{
dir: "src/pages",
baseRoute: "",
},
],
importMode(path) {
return "async";
},
}),
Layouts({
layoutsDirs: "src/layouts",
defaultLayout: "default",
}),
Components({
dirs: ["src/components", "src/layouts"],
extensions: ["vue", "md", "mjs.map"],
dts: true,
include: [/\.vue$/, /\.vue\?vue/, /\.js$/],
resolvers: [
IconsResolver({
prefix: "i",
enabledCollections: ["weather"],
}),
],
}),
Icons({
compiler: "vue3",
customCollections: {
weather: FileSystemIconLoader("src/assets/svg/icons"),
},
}) as PluginOption,
SvgLoader({
svgo: true,
svgoConfig: {
multipass: true,
},
}) as PluginOption,
VitePWA({
base: "/",
registerType: "autoUpdate",
includeAssets: ["favicon.ico"],
manifest: {
name: "Weather App",
short_name: "Weather",
start_url: "/?utm_source=pwa",
display: "standalone",
theme_color: "#ffffff",
background_color: "#ffffff",
icons: [
{
src: "favicon.ico",
},
] as ExtendedIconResource[],
},
}),
],
});