2023-10-16 00:18:24 +08:00
|
|
|
import { resolve } from 'node:path'
|
2023-10-16 11:53:08 +08:00
|
|
|
import { defineConfig, mergeConfig } from 'vite'
|
2023-10-16 00:18:24 +08:00
|
|
|
import useElectron from 'vite-plugin-electron'
|
|
|
|
import useRenderer from 'vite-plugin-electron-renderer'
|
|
|
|
|
|
|
|
import useVue from '@vitejs/plugin-vue'
|
|
|
|
import useEslint from 'vite-plugin-eslint'
|
|
|
|
import useUnoCSS from 'unocss/vite'
|
2023-10-16 16:08:02 +08:00
|
|
|
import usePath from '@viarotel-org/vite-plugin-path'
|
2023-10-16 11:53:08 +08:00
|
|
|
|
|
|
|
const merge = config =>
|
|
|
|
mergeConfig(
|
|
|
|
{
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@root': resolve('./'),
|
|
|
|
'@resources': resolve('./electron/resources'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [usePath()],
|
|
|
|
},
|
|
|
|
config,
|
|
|
|
)
|
2023-10-16 00:18:24 +08:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
assetsInclude: ['**/*.exe'],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': resolve('./src'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
useEslint(),
|
|
|
|
useUnoCSS(),
|
|
|
|
useVue(),
|
|
|
|
useElectron([
|
|
|
|
{
|
|
|
|
entry: 'electron/main.js',
|
2023-10-16 11:53:08 +08:00
|
|
|
vite: merge({}),
|
2023-10-16 00:18:24 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
entry: 'electron/preload.js',
|
|
|
|
onstart(args) {
|
|
|
|
args.reload()
|
|
|
|
},
|
2023-10-16 11:53:08 +08:00
|
|
|
vite: merge({}),
|
2023-10-16 00:18:24 +08:00
|
|
|
},
|
|
|
|
]),
|
|
|
|
useRenderer(),
|
|
|
|
],
|
|
|
|
})
|