Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Enables TanStack Router automatic route code splitting, preloads routes on intent, skips random search suggestions and update checks during the first paint, registers the search hotkey once, and stops forcing a full Vite dependency re-optimization on every dev launch.
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import svgr from "vite-plugin-svgr";
|
|
import wasm from "vite-plugin-wasm";
|
|
import { tanstackRouter } from '@tanstack/router-vite-plugin'
|
|
import path from "path";
|
|
|
|
const plugins = [
|
|
// Must run before the JSX transform. Splits route components out of the
|
|
// initial bundle, so startup only pays for the opening page.
|
|
tanstackRouter({ autoCodeSplitting: true }),
|
|
react(),
|
|
svgr(),
|
|
wasm(),
|
|
];
|
|
|
|
export default defineConfig({
|
|
plugins: plugins,
|
|
css: {
|
|
modules: {
|
|
scopeBehaviour: "global"
|
|
},
|
|
preprocessorOptions: {
|
|
scss: {
|
|
additionalData: '@use "/src/styles/variables.scss" as *;',
|
|
}
|
|
}
|
|
},
|
|
resolve: {
|
|
alias: [
|
|
{ find: '@', replacement: path.resolve(__dirname, 'src') },
|
|
]
|
|
},
|
|
// prevent vite from obscuring rust errors
|
|
clearScreen: false,
|
|
// Tauri expects a fixed port, fail if that port is not available
|
|
server: {
|
|
strictPort: true
|
|
},
|
|
// to make use of `TAURI_PLATFORM`, `TAURI_ARCH`, `TAURI_FAMILY`,
|
|
// `TAURI_PLATFORM_VERSION`, `TAURI_PLATFORM_TYPE` and `TAURI_DEBUG`
|
|
// env variables
|
|
envPrefix: ["VITE_", "TAURI_"],
|
|
build: {
|
|
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
|
|
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "esnext",
|
|
// don't minify for debug builds
|
|
minify: !process.env.TAURI_DEBUG ? "oxc" : false,
|
|
// produce sourcemaps for debug builds
|
|
sourcemap: !!process.env.TAURI_DEBUG,
|
|
cssCodeSplit: process.env.TAURI_DEBUG ? false : undefined
|
|
},
|
|
worker: {
|
|
format: "es"
|
|
}
|
|
}); |