You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
import { resolve } from 'path'
|
|
|
|
|
import { defineConfig, externalizeDepsPlugin, bytecodePlugin } from 'electron-vite'
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
main: {
|
|
|
|
|
plugins: [externalizeDepsPlugin(), bytecodePlugin()]
|
|
|
|
|
},
|
|
|
|
|
preload: {
|
|
|
|
|
plugins: [externalizeDepsPlugin(), bytecodePlugin()]
|
|
|
|
|
},
|
|
|
|
|
renderer: {
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@renderer': resolve('src/renderer/src'),
|
|
|
|
|
'@views': resolve('src/renderer/src/views'),
|
|
|
|
|
'@router': resolve('src/renderer/src/router')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
plugins: [vue()],
|
|
|
|
|
build: {
|
|
|
|
|
// 核心:指定 Vue 打包输出目录(用于 Web 部署)
|
|
|
|
|
outDir: 'dist', // 例如输出到项目根目录的 dist/web 文件夹
|
|
|
|
|
// 其他 Vite 打包配置(与传统 Vue 项目的 vite.config.js 一致)
|
|
|
|
|
assetsDir: 'assets', // 静态资源(图片、字体等)输出目录
|
|
|
|
|
sourcemap: false, // 生产环境关闭 sourcemap
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
// 配置入口文件(默认是 src/renderer/index.html)
|
|
|
|
|
input: resolve('src/renderer/index.html'),
|
|
|
|
|
// 输出文件名哈希(可选,用于缓存控制)
|
|
|
|
|
output: {
|
|
|
|
|
entryFileNames: 'js/[name].[hash].js',
|
|
|
|
|
chunkFileNames: 'js/[name].[hash].js',
|
|
|
|
|
assetFileNames: 'assets/[name].[hash].[ext]'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|