forked from ThinkInAIXYZ/deepchat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectron.vite.config.ts
More file actions
85 lines (84 loc) · 2.09 KB
/
electron.vite.config.ts
File metadata and controls
85 lines (84 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import autoprefixer from 'autoprefixer'
import tailwind from 'tailwindcss'
import vueDevTools from 'vite-plugin-vue-devtools'
import svgLoader from 'vite-svg-loader'
import monacoEditorPlugin from 'vite-plugin-monaco-editor-esm'
import path from 'node:path'
export default defineConfig({
main: {
plugins: [
externalizeDepsPlugin({
exclude: ['mermaid', 'dompurify', 'pyodide']
})
],
resolve: {
alias: {
'@': resolve('src/main/'),
'@shared': resolve('src/shared')
}
},
build: {
rollupOptions: {
external: ['sharp', 'pyodide']
}
}
},
preload: {
plugins: [externalizeDepsPlugin()],
resolve: {
alias: {
'@shared': resolve('src/shared')
}
}
},
renderer: {
optimizeDeps: {
include: [
'monaco-editor',
'axios'
]
},
resolve: {
alias: {
'@': resolve('src/renderer/src'),
'@shell': resolve('src/renderer/shell'),
'@shared': resolve('src/shared'),
vue: 'vue/dist/vue.esm-bundler.js'
}
},
css: {
postcss: {
plugins: [tailwind(), autoprefixer()]
}
},
server: {
host: '0.0.0.0' // 防止代理干扰,导致vite-electron之间ws://localhost:5713和http://localhost:5713通信失败、页面组件无法加载
},
plugins: [
monacoEditorPlugin({
languageWorkers: ['editorWorkerService', 'typescript', 'css', 'html', 'json'],
customDistPath(_root, buildOutDir, _base) {
return path.resolve(buildOutDir, 'monacoeditorwork')
},
}),
vue(),
svgLoader(),
vueDevTools({
// use export LAUNCH_EDITOR=cursor instead
// launchEditor: 'cursor'
})
],
build: {
minify: 'esbuild',
rollupOptions: {
input: {
shell: resolve('src/renderer/shell/index.html'),
index: resolve('src/renderer/index.html')
}
}
}
}
})