Nebula/vite.config.ts
2024-03-07 12:19:12 -06:00

61 lines
1.7 KiB
TypeScript

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";
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
import { baremuxPath } from "@mercuryworkshop/bare-mux";
import path from "path";
const __dirname = path.resolve();
export default defineConfig({
plugins: [
viteStaticCopy({
targets: [
{
// .replace fixes weird paths on Windows
src: `${uvPath}/**/*`.replace(/\\/g, "/"),
dest: "uv",
overwrite: false
},
//{
// src: `${baremuxPath}/**/*`.replace(/\\/g, "/"),
// dest: "mux",
// overwrite: false
//},
{
//include ALL files types
src: `${epoxyPath}/**/*`.replace(/\\/g, "/"),
dest: "epoxy",
overwrite: false
},
{
// .replace fixes weird paths on Windows
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/",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/bare/, "")
}
}
}
});