File size: 804 Bytes
0ad74ed |
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 |
import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
const TEST_MODE = process.env.TEST_MODE || "happy-dom";
export default defineConfig(({ mode }) => {
if (mode === "preview") {
return {
entry: "index.html"
};
}
return {
build: {
lib: {
entry: "src/index.ts",
formats: ["es"],
fileName: (format) => `index.${format}.js`
},
rollupOptions: {
input: "src/index.ts",
output: {
dir: "dist"
}
}
},
plugins: [svelte()],
mode: process.env.MODE || "development",
test: {
include: ["./src/test/*.test.*"],
environment: TEST_MODE
},
ssr: {
target: "node",
format: "esm",
noExternal: [
"ws",
"semiver",
"bufferutil",
"@gradio/upload",
"fetch-event-stream"
]
}
};
});
|