|
|
/*
|
|
|
* @Author: donghao donghao@supervision.ltd
|
|
|
* @Date: 2025-07-02 13:17:44
|
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
|
* @LastEditTime: 2025-07-03 10:00:13
|
|
|
* @FilePath: \electron-project\Robot-Al\Robot-Al-Platform-Web\electron.vite.config.ts
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AEmpo
|
|
|
*/
|
|
|
import { resolve } from 'path'
|
|
|
import { defineConfig, externalizeDepsPlugin, bytecodePlugin } from 'electron-vite'
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
export default defineConfig({
|
|
|
main: {
|
|
|
plugins: [externalizeDepsPlugin(), bytecodePlugin()]
|
|
|
},
|
|
|
preload: {
|
|
|
plugins: [externalizeDepsPlugin(), bytecodePlugin()]
|
|
|
},
|
|
|
renderer: {
|
|
|
resolve: {
|
|
|
alias: {
|
|
|
'@': resolve('src/renderer/src'),
|
|
|
'@renderer': resolve('src/renderer/src'),
|
|
|
'@views': resolve('src/renderer/src/views'),
|
|
|
'@router': resolve('src/renderer/src/router')
|
|
|
}
|
|
|
},
|
|
|
plugins: [
|
|
|
vue(),
|
|
|
AutoImport({
|
|
|
imports: ['vue'],
|
|
|
eslintrc: {
|
|
|
enabled: true
|
|
|
},
|
|
|
resolvers: [ElementPlusResolver()]
|
|
|
}),
|
|
|
Components({
|
|
|
resolvers: [ElementPlusResolver()]
|
|
|
})
|
|
|
],
|
|
|
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]'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
})
|