-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
67 lines (64 loc) · 1.57 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
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/js/app.js",
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
autoimport({
vueTemplate: true,
dirs: ["resources/js/composables", "resources/js/utils"],
imports: [
"vue",
"@vueuse/core",
{
"@inertiajs/vue3": ["router", "usePage", "useRemember"],
"laravel-precognition-vue-inertia": ["useForm"],
},
],
}),
components({
dirs: ["resources/js/Components"],
resolvers: [
// inertia components
(name) => {
const components = ["Link", "Head"];
if (components.includes(name)) {
return {
name: name,
from: "@inertiajs/vue3",
};
}
},
// layouts
(name) => {
if (name.startsWith("Layout")) {
const componentName = name.substring("Layout".length);
return {
name: "default",
from: `/resources/js/Layouts/${componentName}/Layout-${componentName}.vue`,
};
}
},
],
}),
],
});