2023-10-15 18:18:24 +02:00
|
|
|
import { resolve } from 'node:path'
|
2024-09-07 19:55:54 +02:00
|
|
|
import useI18n from '@intlify/unplugin-vue-i18n/vite'
|
|
|
|
import useVue from '@vitejs/plugin-vue'
|
|
|
|
import useUnoCSS from 'unocss/vite'
|
2023-10-16 05:53:08 +02:00
|
|
|
import { defineConfig, mergeConfig } from 'vite'
|
2024-09-07 19:55:54 +02:00
|
|
|
|
|
|
|
import { notBundle } from 'vite-plugin-electron/plugin'
|
2024-05-08 05:02:00 +02:00
|
|
|
import useElectron from 'vite-plugin-electron/simple'
|
2023-10-15 18:18:24 +02:00
|
|
|
import useRenderer from 'vite-plugin-electron-renderer'
|
2023-10-17 11:54:29 +02:00
|
|
|
import useSvg from 'vite-svg-loader'
|
2023-10-16 05:53:08 +02:00
|
|
|
|
2024-05-08 05:02:00 +02:00
|
|
|
import postcssConfig from './postcss.config.js'
|
|
|
|
|
|
|
|
import useAutoImports from './src/plugins/auto.js'
|
2023-11-13 11:35:44 +01:00
|
|
|
|
2023-10-17 12:16:37 +02:00
|
|
|
const merge = (config, { command = '' } = {}) =>
|
2023-10-16 05:53:08 +02:00
|
|
|
mergeConfig(
|
|
|
|
{
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2024-05-15 05:16:02 +02:00
|
|
|
$root: resolve(),
|
|
|
|
$electron: resolve('electron'),
|
|
|
|
$renderer: resolve('src'),
|
2023-10-16 05:53:08 +02:00
|
|
|
},
|
|
|
|
},
|
2023-10-17 12:16:37 +02:00
|
|
|
plugins: [...(command === 'serve' ? [notBundle()] : [])],
|
2023-10-16 05:53:08 +02:00
|
|
|
},
|
|
|
|
config,
|
|
|
|
)
|
2023-10-15 18:18:24 +02:00
|
|
|
|
2024-05-08 05:02:00 +02:00
|
|
|
export default args =>
|
2023-10-17 12:16:37 +02:00
|
|
|
merge(
|
|
|
|
defineConfig({
|
2023-11-17 11:42:50 +01:00
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
2024-05-08 05:02:00 +02:00
|
|
|
main: resolve('index.html'),
|
2023-11-17 11:42:50 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-10-17 12:16:37 +02:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
2024-05-15 05:16:02 +02:00
|
|
|
$: resolve('src'),
|
|
|
|
$electron: resolve('electron'),
|
2023-10-15 18:18:24 +02:00
|
|
|
},
|
2023-10-17 12:16:37 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
useUnoCSS(),
|
|
|
|
useSvg(),
|
|
|
|
useVue(),
|
2023-10-23 12:14:41 +02:00
|
|
|
useI18n({
|
2024-05-08 05:02:00 +02:00
|
|
|
include: [resolve('src/locales/languages/**')],
|
2023-10-23 12:14:41 +02:00
|
|
|
}),
|
2024-05-08 05:02:00 +02:00
|
|
|
useElectron({
|
|
|
|
main: {
|
2023-10-17 12:16:37 +02:00
|
|
|
entry: 'electron/main.js',
|
2024-05-08 05:02:00 +02:00
|
|
|
vite: merge({}, args),
|
2023-10-17 09:27:08 +02:00
|
|
|
},
|
2024-05-08 05:02:00 +02:00
|
|
|
preload: {
|
|
|
|
input: 'electron/preload.js',
|
|
|
|
vite: merge({}, args),
|
2023-10-17 12:16:37 +02:00
|
|
|
},
|
2024-05-08 05:02:00 +02:00
|
|
|
}),
|
2023-10-17 12:16:37 +02:00
|
|
|
useRenderer(),
|
2024-05-08 05:02:00 +02:00
|
|
|
...useAutoImports(),
|
2023-10-17 12:16:37 +02:00
|
|
|
],
|
2023-11-13 11:35:44 +01:00
|
|
|
css: {
|
|
|
|
postcss: postcssConfig,
|
|
|
|
},
|
2023-10-17 12:16:37 +02:00
|
|
|
}),
|
|
|
|
)
|