forked from NebulaServices/Nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
74 lines (73 loc) · 2.08 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
import million from "million/compiler";
import { defineConfig } from "vite";
import preact from "@preact/preset-vite";
import { viteStaticCopy } from "vite-plugin-static-copy";
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
import { dynamicPath } from "@nebula-services/dynamic";
//@ts-ignore
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
//@ts-ignore
import { libcurlPath } from "@mercuryworkshop/libcurl-transport";
import path from "path";
import { createBareServer } from "@tomphttp/bare-server-node";
import wisp from "wisp-server-node";
import http from "http";
const __dirname = path.resolve();
export default defineConfig({
plugins: [
viteStaticCopy({
targets: [
{
src: `${uvPath}/**/*`.replace(/\\/g, "/"),
dest: "uv",
overwrite: false
},
{
src: `${epoxyPath}/**/*`.replace(/\\/g, "/"),
dest: "epoxy",
overwrite: false
},
{
src: `${libcurlPath}/**/*`.replace(/\\/g, "/"),
dest: "libcurl",
overwrite: false
},
{
src: `${dynamicPath}/dynamic.*.js`.replace(/\\/g, "/"),
dest: "dynamic",
overwrite: false
},
{
src: `${__dirname}/node_modules/localforage/dist/localforage.*.js`.replace(
/\\/g,
"/"
),
dest: "localforage",
overwrite: false
}
]
}),
million.vite({ auto: true }),
preact()
],
server: {
proxy: {
"/bare/": {
target: "http://localhost:8080/bare/",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/bare\//, "")
},
"/wisp/": {
target: "http://localhost:8080/wisp/",
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(/^\/wisp\//, "")
},
"/search": {
target: "http://localhost:8080/search",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/search/, "")
}
}
}
});