51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
import ElementPlus from 'unplugin-element-plus/vite'
|
|
import path from "path";
|
|
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
clearScreen: false,
|
|
// Tauri expects a fixed port, fail if that port is not available
|
|
server: {
|
|
strictPort: true,
|
|
},
|
|
envPrefix: ['VITE_', 'TAURI_PLATFORM', 'TAURI_ARCH', 'TAURI_FAMILY', 'TAURI_PLATFORM_VERSION', 'TAURI_PLATFORM_TYPE', 'TAURI_DEBUG'],
|
|
plugins: [
|
|
vue(),
|
|
vueDevTools(),
|
|
createSvgIconsPlugin({
|
|
iconDirs: [
|
|
path.resolve(__dirname, "src/assets/svgs"),
|
|
],
|
|
symbolId: "icon-[name]"
|
|
}),
|
|
ElementPlus({
|
|
// options
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
build: {
|
|
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
|
|
target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13',
|
|
// don't minify for debug builds
|
|
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
|
|
// 为调试构建生成源代码映射 (sourcemap)
|
|
sourcemap: !!process.env.TAURI_DEBUG,
|
|
rollupOptions: {
|
|
input: {
|
|
main: path.resolve(__dirname, 'index.html'),
|
|
video: path.resolve(__dirname, 'video/index.html'),
|
|
},
|
|
},
|
|
},
|
|
})
|