-
Notifications
You must be signed in to change notification settings - Fork 14
/
vite.config.js
42 lines (39 loc) · 1.23 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
import { fileURLToPath, URL } from 'url';
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import dotenv from 'dotenv';
import { basename } from 'path'
export default defineConfig(({ mode }) => {
// Default valet hostname guess is repo.test, but you can override
// this by setting the VALET_DOMAIN environment variable in a .env file
const envConfig = dotenv.config({
path: './.env' ?? `./.env.${mode}`,
});
const envAppUrl = new URL(
envConfig?.parsed?.APP_URL ??
`http://${ basename(__dirname)}.test`
);
return {
resolve: {
alias: {
'@': fileURLToPath(new URL('./resources/ts', import.meta.url)),
},
},
plugins: [
laravel({
input: ['resources/ts/app.ts'],
refresh: true,
valetTls: !envConfig?.parsed?.LARAVEL_SAIL ?? envAppUrl.hostname,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
};
});