-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
63 lines (61 loc) · 1.45 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
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
function getBackendUrl(path: string) {
return `${process.env.FRONTEND_URL || "http://localhost:8000"}${path}`;
}
const STATIC_URL = process.env.STATIC_URL || "/static/";
export default defineConfig({
base: `${STATIC_URL}`,
root: path.join(__dirname, "src/app/domain/web/resources"),
optimizeDeps: {
force: true,
},
server: {
fs: {
allow: [".", path.join(__dirname, "node_modules")],
},
host: "0.0.0.0",
port: 3005,
cors: true,
strictPort: true,
watch: {
ignored: ["node_modules", ".venv", "**/__pycache__/**"],
},
proxy: {
"/api": {
target: getBackendUrl("/api"),
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
plugins: [vue()],
build: {
target: "esnext",
outDir: "../public",
emptyOutDir: true,
assetsDir: "assets/",
manifest: true,
rollupOptions: {
input: path.join(__dirname, "src/app/domain/web/resources/main.ts"),
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
return id
.toString()
.split("node_modules/")[1]
.split("/")[0]
.toString();
}
},
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src/frontend"),
},
},
});