2022-02-02 02:25:20 +08:00
|
|
|
import { defineConfig } from "vite";
|
|
|
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
|
|
import sveltePreprocess from "svelte-preprocess";
|
|
|
|
|
|
|
|
// this is dupe config, gonna try fix this
|
|
|
|
import tailwind from "tailwindcss";
|
2022-02-23 19:17:41 +08:00
|
|
|
import nested from "tailwindcss/nesting";
|
2022-02-02 02:25:20 +08:00
|
|
|
|
2022-02-18 05:21:18 +08:00
|
|
|
//@ts-ignore
|
2022-02-02 02:25:20 +08:00
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
const production = mode === "production";
|
|
|
|
|
|
|
|
return {
|
2022-02-18 21:50:34 +08:00
|
|
|
base: "./",
|
2022-02-03 18:35:14 +08:00
|
|
|
build: {
|
|
|
|
outDir: "../../../gradio/templates/frontend"
|
|
|
|
},
|
2022-02-02 02:25:20 +08:00
|
|
|
define: {
|
|
|
|
BUILD_MODE: production ? JSON.stringify("prod") : JSON.stringify("dev"),
|
2022-02-02 23:49:37 +08:00
|
|
|
BACKEND_URL: production
|
|
|
|
? JSON.stringify("")
|
|
|
|
: JSON.stringify("http://localhost:7860/")
|
2022-02-02 02:25:20 +08:00
|
|
|
},
|
2022-02-18 05:21:18 +08:00
|
|
|
css: {
|
|
|
|
postcss: {
|
|
|
|
plugins: [nested, tailwind]
|
|
|
|
}
|
|
|
|
},
|
2022-02-02 02:25:20 +08:00
|
|
|
plugins: [
|
|
|
|
svelte({
|
|
|
|
preprocess: sveltePreprocess({
|
2022-03-12 00:00:48 +08:00
|
|
|
postcss: { plugins: [tailwind, nested] }
|
2022-02-02 02:25:20 +08:00
|
|
|
})
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|
|
|
|
});
|