-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite-plugins.ts
123 lines (121 loc) · 3.19 KB
/
vite-plugins.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
import Pages from "@tachibana-shin/vite-plugin-pages"
import { unheadVueComposablesImports } from "@unhead/vue"
import { OnuResolver } from "onu-ui"
import UnoCSS from "unocss/vite"
import AutoImport from "unplugin-auto-import/vite"
import IconsResolver from "unplugin-icons/resolver"
import Icons from "unplugin-icons/vite"
import Components from "unplugin-vue-components/vite"
import DefineOptions from "unplugin-vue-define-options/vite"
// import { VueRouterAutoImports } from "unplugin-vue-router"
// import VueRouter from "unplugin-vue-router/vite"
import type { Plugin } from "vite"
import { ViteImageOptimizer as ImageOptimizer } from "vite-plugin-image-optimizer"
import imagePresets, { widthPreset } from "vite-plugin-image-presets"
import RemoveConsole from "vite-plugin-remove-console"
import ReWriteAll from "vite-plugin-rewrite-all"
import Layouts from "vite-plugin-vue-layouts"
import vitePluginBuildRaw from "./modules/vite-plugin-build-raw"
import vitePluginI18nLangs from "./modules/vite-plugin-i18n-langs"
export const vitePlugins: [
(conf: object | undefined) => Plugin | Plugin[],
object | undefined
][] = [
// [VueRouter, {}],
[vitePluginI18nLangs, {}],
[
Pages,
{
routeStyle: "nuxt3",
importMode: () => "async"
}
],
[ReWriteAll, {}],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[RemoveConsole as unknown as any, {}],
[
Layouts,
{
defaultLayout: "MainLayout"
}
],
[
UnoCSS,
{
configFile: "./uno.config.ts"
}
],
[
AutoImport,
{
resolvers: [OnuResolver()],
include: [/\.tsx?$/, /\.vue$/, /\.vue\?vue/],
imports: [
"vue",
"vue-router",
// VueRouterAutoImports,
{
"@iconify/vue": ["Icon"],
"@vueuse/core": ["computedAsync", "watchImmediate", "useStorage"],
"@vueuse/router": ["useRouteParams"],
quasar: ["useQuasar"],
"vue-request": ["useRequest"],
"vue-i18n": ["useI18n"],
"@tachibana-shin/capacitor-filesystem": [
"Filesystem",
"Directory",
"Encoding"
]
},
unheadVueComposablesImports
],
dirs: [
"src/logic/**/*.ts",
"src/logic/**/*.tsx",
"src/stores/**/*.ts",
"src/composables/*.ts",
"src/boot/*.ts",
"src/errors/*.ts",
"src/*.ts"
],
eslintrc: {
enabled: true,
filepath: "./.eslintrc-auto-import.json",
globalsPropValue: true
}
}
],
[
Components,
{
resolvers: [
IconsResolver(),
OnuResolver(),
(componentName: string) => {
if (componentName.toLowerCase() === "icon")
return {
name: componentName,
from: "@iconify/vue"
}
}
]
}
],
[DefineOptions, {}],
[vitePluginBuildRaw, {}],
[Icons, {}],
[ImageOptimizer, {}],
[
// eslint-disable-next-line @typescript-eslint/no-explicit-any
imagePresets as unknown as any,
{
thumbnail: widthPreset({
widths: [48, 96],
formats: {
webp: { quality: 100 },
jpg: { quality: 100 }
}
})
}
]
]