mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-12-24 11:25:52 +08:00
53 lines
1.4 KiB
TypeScript
53 lines
1.4 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: {
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
index: resolve('src/renderer/index.html'),
|
|
floating: resolve('src/renderer/floating.html')
|
|
}
|
|
}
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@renderer': resolve('src/renderer/src')
|
|
}
|
|
},
|
|
plugins: [
|
|
react(),
|
|
monacoEditorPlugin({
|
|
languageWorkers: ['editorWorkerService', 'typescript', 'css'],
|
|
customDistPath: (_, out) => `${out}/monacoeditorwork`,
|
|
customWorkers: [
|
|
{
|
|
label: 'yaml',
|
|
entry: 'monaco-yaml/yaml.worker'
|
|
}
|
|
]
|
|
})
|
|
]
|
|
}
|
|
})
|