src-ui/vite.config.ts
Rama main · réplica de lectura del repositorio original.
import { paraglideVitePlugin } from "@inlang/paraglide-js";
import adapter from "@sveltejs/adapter-static";
import { sveltekit } from "@sveltejs/kit/vite";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
const host = process.env.TAURI_DEV_HOST;
// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [
tailwindcss(),
paraglideVitePlugin({
project: "./project.inlang",
outdir: "./src/lib/paraglide",
strategy: ["localStorage", "preferredLanguage", "baseLocale"]
}),
sveltekit({
adapter: adapter(),
embedded: true,
preprocess: vitePreprocess()
})
],
build: {
target: ["es2022"],
sourcemap: !!process.env.TAURI_ENV_DEBUG,
rollupOptions: {
output: {
manualChunks() {
// Lower the number of output files from ~30 to ~16.
return "vendor";
}
}
}
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421
}
: undefined,
watch: {
// 3. tell vite to ignore watching `crates/memospot`
ignored: ["**/crates/memospot/**"]
}
}
}));