-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
80 lines (77 loc) · 2.79 KB
/
vite.config.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
import vue from '@vitejs/plugin-vue'
import laravel from 'laravel-vite-plugin'
import inertiaLayout from 'momentum-layout'
import autoimport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { defineConfig, loadEnv } from 'vite'
import manifestSRI from 'vite-plugin-manifest-sri'
import { watch } from 'vite-plugin-watch'
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
return defineConfig({
css: {
devSourcemap: process.env.VITE_ENV !== 'production',
},
resolve: {
alias: {
'@': '/resources/js',
'~': '/node_modules',
},
},
plugins: [
autoimport({
eslintrc: {
enabled: true,
},
vueTemplate: true,
dts: 'resources/js/Types/auto-imports.d.ts',
dirs: ['resources/js/Composables', 'resources/js/Enums'],
imports: [
'vue',
{ 'momentum-trail': ['route', 'current'] },
{ '@inertiajs/vue3': ['router', 'useForm', 'usePage'] },
],
}),
Components({
dirs: ['resources/js/Components'],
dts: 'resources/js/Types/auto-components.d.ts',
resolvers: [
(name: string) => {
const components = {
InertiaLink: { component: 'Link', lib: '@inertiajs/vue3' },
InertiaHead: { component: 'Head', lib: '@inertiajs/vue3' },
}
if (name in components) {
return {
name: components[name]?.component,
from: components[name]?.lib,
}
}
},
],
}),
laravel({
input: ['resources/css/app.css', 'resources/js/app.ts'],
refresh: ['routes/**', 'resources/css/**', 'resources/js/**'],
valetTls: process.env.VITE_VALET_TLS ? 'twitchai.test' : undefined,
}),
inertiaLayout(),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
watch({
pattern: 'routes/**/*.php',
command: 'php artisan trail:generate',
}),
manifestSRI(),
],
ssr: {
noExternal: ['@inertiajs/vue3/server', 'vue-toastification'],
},
})
}