mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-06 08:32:51 +08:00
🔧 参考最新项目修改配置
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file vite.config.ts
|
||||
* @description vite 配置文件
|
||||
* @since Beta v0.6.5
|
||||
* @since Beta v0.7.2
|
||||
*/
|
||||
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
@@ -11,7 +11,7 @@ import vuetify from "vite-plugin-vuetify";
|
||||
|
||||
import buildTimePlugin from "./src/utils/TGBuild.js";
|
||||
|
||||
const env: TauriProcessEnv = process.env;
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
@@ -26,31 +26,13 @@ export default defineConfig({
|
||||
"@Bili/": "/src/plugins/Bili/",
|
||||
},
|
||||
},
|
||||
clearScreen: false,
|
||||
server: { port: 4000, strictPort: true },
|
||||
envPrefix: ["VITE_", "TAURI_"],
|
||||
esbuild: { supported: { "top-level-await": true } },
|
||||
build: {
|
||||
// Tauri supports es2021
|
||||
target: env.TAURI_PLATFORM === "windows" ? "chrome105" : "safari13",
|
||||
// don't minify for debug builds
|
||||
minify: !env.TAURI_DEBUG ? "esbuild" : false,
|
||||
// produce sourcemaps for debug builds
|
||||
sourcemap: !!env.TAURI_DEBUG,
|
||||
// chunk size warning limit, default is 500kB,here set 4096KB which is 4MB
|
||||
chunkSizeWarningLimit: 4096, // KB
|
||||
// rollup options
|
||||
rollupOptions: {
|
||||
// chunking
|
||||
output: {
|
||||
manualChunks(id: string) {
|
||||
// pnpm 依赖包路径格式为 本地路径/node_modules/.pnpm/包名@版本号/node_modules/依赖包名/文件路径
|
||||
if (id.includes("node_modules")) {
|
||||
const arr = id.split("node_modules/");
|
||||
return arr[2].split("/")[0];
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 4000,
|
||||
strictPort: true,
|
||||
host: host || false,
|
||||
hmr: host ? { protocol: "ws", host, port: 4001 } : undefined,
|
||||
watch: { ignored: ["**/src-tauri/**"] },
|
||||
},
|
||||
esbuild: { supported: { "top-level-await": true } },
|
||||
build: { chunkSizeWarningLimit: 4096 },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user