Files
DiffLens/electron.vite.config.ts

39 lines
1.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
main: {
// iconv-lite 打包进产物:解码 worker 随 asarUnpack 加载,unpacked 路径下无法
// 解析 asar 内的 node_modulesElectron 的 asar 补丁不覆盖 worker 线程)
plugins: [externalizeDepsPlugin({ exclude: ['iconv-lite'] })],
build: {
sourcemap: false,
rollupOptions: {
// 双入口:主进程 + 解码 workerworker_threads 无法加载 asar 内脚本,需单独产物)
input: {
index: resolve('src/main/index.ts'),
decodeWorker: resolve('src/main/decodeWorker.ts')
},
output: {
entryFileNames: '[name].js',
format: 'cjs'
}
}
}
},
preload: {
plugins: [externalizeDepsPlugin()],
build: {
sourcemap: false
}
},
renderer: {
resolve: {
alias: {
'@renderer': resolve('src/renderer/src')
}
},
plugins: [react()]
}
})