mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-15 19:22:31 +08:00
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { resolve } from 'path'
|
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
|
import react from '@vitejs/plugin-react'
|
|
// https://github.com/vdesjs/vite-plugin-monaco-editor/issues/21#issuecomment-1827562674
|
|
import monacoEditorPluginModule from 'vite-plugin-monaco-editor'
|
|
const isObjectWithDefaultFunction = (
|
|
module: unknown
|
|
): module is { default: typeof monacoEditorPluginModule } =>
|
|
module != null &&
|
|
typeof module === 'object' &&
|
|
'default' in module &&
|
|
typeof module.default === 'function'
|
|
const monacoEditorPlugin = isObjectWithDefaultFunction(monacoEditorPluginModule)
|
|
? monacoEditorPluginModule.default
|
|
: monacoEditorPluginModule
|
|
|
|
export default defineConfig({
|
|
main: {
|
|
plugins: [externalizeDepsPlugin()]
|
|
},
|
|
preload: {
|
|
plugins: [externalizeDepsPlugin()]
|
|
},
|
|
renderer: {
|
|
resolve: {
|
|
alias: {
|
|
'@renderer': resolve('src/renderer/src')
|
|
}
|
|
},
|
|
plugins: [
|
|
react(),
|
|
monacoEditorPlugin({
|
|
languageWorkers: ['editorWorkerService', 'typescript', 'json'],
|
|
customDistPath: () => 'out/renderer',
|
|
customWorkers: [
|
|
{
|
|
label: 'yaml',
|
|
entry: 'monaco-yaml/yaml.worker'
|
|
}
|
|
]
|
|
})
|
|
]
|
|
}
|
|
})
|