escrcpy/vite.config.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-10-15 18:18:24 +02:00
import { resolve } from 'node:path'
import { defineConfig, mergeConfig } from 'vite'
2023-10-15 18:18:24 +02:00
import useElectron from 'vite-plugin-electron'
import useRenderer from 'vite-plugin-electron-renderer'
import { notBundle } from 'vite-plugin-electron/plugin'
2023-10-15 18:18:24 +02:00
import useVue from '@vitejs/plugin-vue'
import useEslint from 'vite-plugin-eslint'
import useUnoCSS from 'unocss/vite'
import useSvg from 'vite-svg-loader'
2023-10-23 12:14:41 +02:00
import useI18n from '@intlify/unplugin-vue-i18n/vite'
const merge = (config, { command = '' } = {}) =>
mergeConfig(
{
resolve: {
alias: {
'@root': resolve(),
'@electron': resolve('electron'),
},
},
plugins: [...(command === 'serve' ? [notBundle()] : [])],
},
config,
)
2023-10-15 18:18:24 +02:00
// https://vitejs.dev/config/
export default params =>
merge(
defineConfig({
resolve: {
alias: {
'@': resolve('src'),
'@electron': resolve('electron'),
2023-10-15 18:18:24 +02:00
},
},
plugins: [
useEslint(),
useUnoCSS(),
useSvg(),
useVue(),
2023-10-23 12:14:41 +02:00
useI18n({
2023-10-24 14:55:12 +02:00
include: [resolve(__dirname, './src/locales/languages/**')],
2023-10-23 12:14:41 +02:00
}),
useElectron([
{
entry: 'electron/main.js',
vite: merge({}, params),
},
{
entry: 'electron/preload.js',
onstart(args) {
args.reload()
},
vite: merge({}, params),
},
]),
useRenderer(),
],
}),
)