mirror of
https://github.com/Xinrea/bili-shadowreplay.git
synced 2025-11-24 20:15:34 +08:00
* feat: ignore pre-release on version check * feat: new clip-manage page * chore: rename custom scrollbar class
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import { resolve } from "path";
|
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
import sveltePreprocess from "svelte-preprocess";
|
|
import { readFileSync } from "fs";
|
|
|
|
// Read package.json
|
|
const packageJson = JSON.parse(
|
|
readFileSync(resolve(__dirname, "package.json"), "utf-8")
|
|
);
|
|
|
|
// https://vitejs.dev/config/
|
|
// @ts-ignore
|
|
export default defineConfig(async ({ mode }) => {
|
|
// Load env file based on `mode` in the current working directory.
|
|
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
|
|
return {
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(packageJson.version),
|
|
__API_BASE_URL__: JSON.stringify(env.API_BASE_URL || ""),
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ["@ffmpeg/ffmpeg", "@ffmpeg/util"],
|
|
},
|
|
plugins: [
|
|
svelte({
|
|
preprocess: [
|
|
sveltePreprocess({
|
|
typescript: true,
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
|
|
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
|
// prevent vite from obscuring rust errors
|
|
clearScreen: false,
|
|
// tauri expects a fixed port, fail if that port is not available
|
|
server: {
|
|
port: 8054,
|
|
strictPort: true,
|
|
},
|
|
// to make use of `TAURI_DEBUG` and other env variables
|
|
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
|
|
envPrefix: ["VITE_", "TAURI_"],
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
main: resolve(__dirname, "index.html"),
|
|
live: resolve(__dirname, "index_live.html"),
|
|
clip: resolve(__dirname, "index_clip.html"),
|
|
},
|
|
},
|
|
// Tauri supports es2021
|
|
target:
|
|
process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
|
|
// don't minify for debug builds
|
|
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
|
|
// produce sourcemaps for debug builds
|
|
sourcemap: !!process.env.TAURI_DEBUG,
|
|
},
|
|
};
|
|
});
|