refactor: remove manual chunking logic from Vite configuration

- Eliminated custom output chunking strategy for worker files and node_modules from the electron Vite configuration.
- Streamlined the configuration for improved maintainability and clarity.
This commit is contained in:
kangfenmao 2025-05-23 15:41:55 +08:00
parent f6d71868cb
commit 2f3a3c8c48

View File

@ -83,23 +83,6 @@ export default defineConfig({
input: {
index: resolve(__dirname, 'src/renderer/index.html'),
miniWindow: resolve(__dirname, 'src/renderer/miniWindow.html')
},
output: {
manualChunks: (id: string) => {
// 检测所有 worker 文件,提取 worker 名称作为 chunk 名
if (id.includes('.worker') && id.endsWith('?worker')) {
const workerName = id.split('/').pop()?.split('.')[0] || 'worker'
return `workers/${workerName}`
}
// All node_modules are in the vendor chunk
if (id.includes('node_modules')) {
return 'vendor'
}
// Other modules use default chunk splitting strategy
return undefined
}
}
}
}