Skip to content

Commit

Permalink
Copy config from example
Browse files Browse the repository at this point in the history
  • Loading branch information
binamkayastha committed Aug 11, 2024
1 parent 22e0b3b commit 1650d39
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions nepalingo-web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import tsconfigPaths from "vite-tsconfig-paths";
import { resolve } from "path";
import tailwindcss from "tailwindcss";

export default defineConfig({
const host = process.env.TAURI_DEV_HOST;

// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [react(), tsconfigPaths()],
css: {
postcss: {
Expand All @@ -16,4 +19,26 @@ export default defineConfig({
"@": resolve(__dirname, "src"),
},
},
});

// 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 `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
}));

0 comments on commit 1650d39

Please sign in to comment.