-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
65 lines (62 loc) · 2.05 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
import { defineConfig, loadEnv } from 'vite';
import laravel from 'laravel-vite-plugin';
import path from "node:path";
import importMetaUrlPlugin from '@codingame/esbuild-import-meta-url-plugin';
export default defineConfig(({ mode }) =>
{
/**
* all of these hoops need to be jumped through
* in order to run laravel sail + vite behind
* a reverse proxy.
*/
const env = loadEnv(mode, process.cwd(), '');
const appURL = new URL(env.APP_URL || 'http://localhost');
return {
plugins: [
laravel({
input: [
'resources/css/app/goldenlayout-base.scss',
'resources/css/app/goldenlayout-dark-theme.scss',
'resources/css/app/goldenlayout-light-theme.scss',
'resources/css/normalize.scss',
'resources/css/disagreed.scss',
'resources/js/disagreed.js',
'resources/css/app.scss',
'resources/js/app-preload.ts'
],
refresh: true,
}),
],
optimizeDeps: {
esbuildOptions: {
plugins: [
importMetaUrlPlugin
]
}
},
define: {
rootDirectory: JSON.stringify(__dirname)
},
worker: {
format: "es"
},
server: {
host: '0.0.0.0',
port: 5173,
hmr: {
host: appURL.hostname,
protocol: (appURL.protocol === 'https:') ? 'wss' : 'ws',
clientPort: parseInt(appURL.port || ((appURL.protocol === 'https:') ? "443" : "80")),
},
watch: {
ignored: [
path.join(process.cwd(), "storage", "app", "workspaces", "**")
]
}
},
/**
* If we're in dev mode, we base on /vite/ otherwise use the default for building.
*/
base: (mode !== "production") ? "/vite/" : "./",
};
});