gradio/client/js/vite.config.js
Hannah 7aca673b38
Add eventsource polyfill for Node.js and browser environments (#8118)
* add msw setup and initialisation tests

* add changeset

* add eventsource polyfill for node and browser envs

* add changeset

* add changeset

* config tweak

* types

* update eventsource usage

* add changeset

* add walk_and_store_blobs improvements and add tests

* add changeset

* api_info tests

* add direct space URL link tests

* fix tests

* add view_api tests

* add post_message test

* tweak

* add spaces tests

* jwt and protocol tests

* add post_data tests

* test tweaks

* dynamically import eventsource

* revet eventsource imports

* add node test

* lockfile

* add client test in root pkg file

* lcokfile

* remove eventsource from js/app

* add changeset

* remove ts ignore

* move eventsource polyfill to eventsource factory

* add changeset

* tweak

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-02 22:49:55 +02:00

33 lines
636 B
JavaScript

import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
const TEST_MODE = process.env.TEST_MODE || "happy-dom";
export default defineConfig({
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"]
}
});