36 lines
856 B
JavaScript
36 lines
856 B
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
import electron from 'vite-plugin-electron'
|
|
import { fileURLToPath } from 'url';
|
|
|
|
export default defineConfig({
|
|
base: './',
|
|
plugins: [
|
|
vue(),
|
|
vueDevTools(),
|
|
electron({
|
|
entry: 'electron/main.js',
|
|
onstart(options) {
|
|
// 确保只启动一个 Electron 实例
|
|
options.startup(['.', '--no-sandbox']);
|
|
}
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
},
|
|
},
|
|
build: {
|
|
// 确保打包后的文件使用相对路径
|
|
rollupOptions: {
|
|
output: {
|
|
assetFileNames: 'assets/[name]-[hash].[ext]',
|
|
chunkFileNames: 'chunks/[name]-[hash].js',
|
|
entryFileNames: 'entry-[name]-[hash].js',
|
|
}
|
|
}
|
|
}
|
|
})
|