-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
92 lines (91 loc) · 2.33 KB
/
vite.config.js
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
import { ViteImageOptimizer } from "vite-plugin-image-optimizer";
import { defineConfig } from "vite";
import { fileURLToPath, URL } from "node:url";
import vue from "@vitejs/plugin-vue";
import Icons from "unplugin-icons/vite";
import Components from "unplugin-vue-components/vite";
import AutoImport from "unplugin-auto-import/vite";
import IconsResolver from "unplugin-icons/resolver";
import { PrimeVueResolver } from "unplugin-vue-components/resolvers";
import { dirname, resolve } from "node:path";
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
// https://vitejs.dev/config/
export default defineConfig({
base: process.env.NODE_ENV === "production" ? "/forecast/" : "/",
build: {
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
error: resolve(__dirname, "404.html"),
},
},
},
plugins: [
vue(),
ViteImageOptimizer({
svg: {
multipass: true,
plugins: [
{
name: "preset-default",
params: {
overrides: {
cleanupNumericValues: false,
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
},
cleanupIDs: {
minify: false,
remove: false,
},
convertPathData: false,
},
},
"sortAttrs",
{
name: "addAttributesToSVGElement",
params: {
attributes: [{ xmlns: "http://www.w3.org/2000/svg" }],
},
},
VueI18nPlugin({
include: resolve(
dirname(fileURLToPath(import.meta.url)),
"./src/i18n/locales/**"
),
}),
],
},
png: {
quality: 100,
},
jpeg: {
quality: 100,
},
jpg: {
quality: 100,
},
webp: {
lossless: true,
},
}),
Components({ resolvers: [IconsResolver(), PrimeVueResolver()] }),
Icons({
/* options */
}),
AutoImport({
/* options */
}),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/style/var.scss"; @import "@/style/_adaptive.scss";`,
},
},
},
});