- beautifului.dev 组件直连:Sidebar Nav、Tool Chips、Approval Card(抽屉化)、Streaming/Thinking、Code Block、Selection Actions、Prompt Bar、Search
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { resolve } from 'node:path'
|
||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
||
import react from '@vitejs/plugin-react'
|
||
import tailwindcss from '@tailwindcss/vite'
|
||
|
||
export default defineConfig({
|
||
main: {
|
||
// pi SDK 为纯 ESM 包,主进程输出 ESM(Electron ≥28 支持)
|
||
plugins: [externalizeDepsPlugin()],
|
||
build: {
|
||
rollupOptions: {
|
||
// electron 保持内置模块导入;pi 全家桶运行时从 node_modules 以 ESM 加载,
|
||
// 同时避开 pi 实验性导出引用的未声明子包问题
|
||
external: ['electron', /^@earendil-works\//],
|
||
output: {
|
||
format: 'es',
|
||
entryFileNames: '[name].mjs'
|
||
}
|
||
}
|
||
},
|
||
resolve: {
|
||
alias: {
|
||
'@main': resolve(__dirname, 'src/main'),
|
||
'@shared': resolve(__dirname, 'src/shared')
|
||
}
|
||
}
|
||
},
|
||
preload: {
|
||
plugins: [externalizeDepsPlugin()],
|
||
build: {
|
||
rollupOptions: {
|
||
// electron 解析为内置模块,避免把 npm 包打进 preload
|
||
external: ['electron'],
|
||
output: {
|
||
format: 'cjs',
|
||
// "type":"module" 下 .js 会被当 ESM 加载,preload 必须用 .cjs
|
||
entryFileNames: '[name].cjs'
|
||
}
|
||
}
|
||
},
|
||
resolve: {
|
||
alias: {
|
||
'@shared': resolve(__dirname, 'src/shared')
|
||
}
|
||
}
|
||
},
|
||
renderer: {
|
||
plugins: [react(), tailwindcss()],
|
||
resolve: {
|
||
alias: {
|
||
'@': resolve(__dirname, 'src/renderer/src'),
|
||
'@renderer': resolve(__dirname, 'src/renderer/src'),
|
||
'@shared': resolve(__dirname, 'src/shared')
|
||
}
|
||
}
|
||
}
|
||
})
|