mirror of
https://gitee.com/viarotel-org/escrcpy.git
synced 2024-12-02 03:07:35 +08:00
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
import { resolve } from 'node:path'
|
|
import { defineConfig, mergeConfig } from 'vite'
|
|
import useElectron from 'vite-plugin-electron'
|
|
import useRenderer from 'vite-plugin-electron-renderer'
|
|
import { notBundle } from 'vite-plugin-electron/plugin'
|
|
|
|
import useVue from '@vitejs/plugin-vue'
|
|
import useEslint from 'vite-plugin-eslint'
|
|
import useUnoCSS from 'unocss/vite'
|
|
import useSvg from 'vite-svg-loader'
|
|
|
|
const merge = (config, { command = '' } = {}) =>
|
|
mergeConfig(
|
|
{
|
|
resolve: {
|
|
alias: {
|
|
'@root': resolve(),
|
|
'@electron': resolve('electron'),
|
|
},
|
|
},
|
|
plugins: [...(command === 'serve' ? [notBundle()] : [])],
|
|
},
|
|
config,
|
|
)
|
|
|
|
// https://vitejs.dev/config/
|
|
export default params =>
|
|
merge(
|
|
defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve('src'),
|
|
},
|
|
},
|
|
plugins: [
|
|
useEslint(),
|
|
useUnoCSS(),
|
|
useSvg(),
|
|
useVue(),
|
|
useElectron([
|
|
{
|
|
entry: 'electron/main.js',
|
|
vite: merge({}, params),
|
|
},
|
|
{
|
|
entry: 'electron/preload.js',
|
|
onstart(args) {
|
|
args.reload()
|
|
},
|
|
vite: merge({}, params),
|
|
},
|
|
]),
|
|
useRenderer(),
|
|
],
|
|
}),
|
|
)
|