-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
vite.config.js
80 lines (76 loc) · 2.42 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
import { defineConfig } from "vite"
import laravel from "laravel-vite-plugin"
import vue from "@vitejs/plugin-vue"
import autoimport from "unplugin-auto-import/vite"
import components from "unplugin-vue-components/vite"
export default defineConfig({
resolve: {
alias: {
"@": "/resources",
"~": "/node_modules",
},
},
plugins: [
laravel({
input: "resources/scripts/app.ts",
ssr: "resources/scripts/ssr.ts",
publicDirectory: "resources/dist",
buildDirectory: "vendor/translations-ui",
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
script: {
defineModel: true,
propsDestructure: true,
},
}),
autoimport({
vueTemplate: true,
dts: "resources/scripts/types/auto-imports.d.ts",
dirs: ["resources/scripts/composables", "resources/scripts/utils"],
imports: [
"vue",
"@vueuse/core",
{
"momentum-lock": ["can"],
},
{
"momentum-modal": ["useModal"],
},
{
"@inertiajs/vue3": ["router", "useForm", "usePage", "useRemember"],
},
],
}),
components({
dirs: ["resources/views/components"],
dts: "resources/scripts/types/components.d.ts",
resolvers: [
(name) => {
const components = ["Link", "Head"]
if (components.includes(name)) {
return {
name: name,
from: "@inertiajs/vue3",
}
}
},
(name) => {
if (name.startsWith("Layout")) {
const componentName = name.substring("Layout".length).toLowerCase()
return {
name: "default",
from: `@/views/layouts/${componentName}/layout-${componentName}.vue`,
}
}
},
],
}),
],
})