-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
125 lines (112 loc) · 3.11 KB
/
vite.config.ts
File metadata and controls
125 lines (112 loc) · 3.11 KB
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
import VueI18n from "@intlify/unplugin-vue-i18n/vite";
import Vue from "@vitejs/plugin-vue";
import ReactivityTransform from "@vue-macros/reactivity-transform/vite";
import { BootstrapVueNextResolver } from "bootstrap-vue-next";
import path from "path";
import AutoImport from "unplugin-auto-import/vite";
import IconsResolve from "unplugin-icons/resolver";
import Icons from "unplugin-icons/vite";
import Components from "unplugin-vue-components/vite";
import type { PluginOption } from "vite";
import { defineConfig } from "vite";
import { DynamicPublicDirectory } from "vite-multiple-assets";
import Pages from "vite-plugin-pages";
import Layouts from "vite-plugin-vue-layouts";
import getViteAliases from "../../vite-aliases";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
resolve: {
dedupe: [
"pinia",
"vue",
"vue-i18n",
"vue-router",
"@vueuse/core",
"bootstrap-vue-next",
],
alias: getViteAliases(path.resolve(__dirname, "../.."), {
"~": `${path.resolve(__dirname, "src")}/`,
"~web": path.resolve(__dirname, "../web"),
"~edgecreator-services": path.resolve(__dirname, "api/services"),
"~types/": `${path.resolve(__dirname, "types")}/`,
}),
},
publicDir: false,
plugins: [
DynamicPublicDirectory(["public/**", "../web/public/**"]) as PluginOption,
ReactivityTransform(),
Vue({
template: {
transformAssetUrls: {
img: [""],
},
},
}),
// https://github.com/hannoeru/vite-plugin-pages
Pages(),
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
Layouts(),
// https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n
VueI18n({
runtimeOnly: false,
compositionOnly: true,
include: [path.resolve(__dirname, "..", "locales/**")],
}),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: [
"vue",
"vue/macros",
"vue-router",
"@vueuse/core",
"pinia",
"vue-i18n",
],
dts: true,
dirs: [
"./src/composables",
"./src/components",
"./types",
"../../packages/types",
"../web/src/stores",
],
vueTemplate: true,
}),
Icons({
compiler: "vue3",
autoInstall: true,
}),
// https://github.com/antfu/vite-plugin-components
Components({
resolvers: [BootstrapVueNextResolver(), IconsResolve()],
dirs: [
"src/components",
"src/layouts",
"../web/src/components",
"../web/src/stores",
"../../packages/types",
],
dts: true,
deep: true,
}),
],
server: {
forwardConsole: true,
watch: {
ignored: ["**/api/**", "**/.idea/**"],
},
},
...(mode === "generate-svg" && {
build: {
ssr: "scripts/generate-svg-from-v1-models.ts",
outDir: "dist-generate-svg",
emptyOutDir: true,
rolldownOptions: {
input: "scripts/generate-svg-from-v1-models.ts",
output: {
entryFileNames: "generate-svg.js",
},
},
},
}),
}));