Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { defineConfig } from 'electron-vite';
|
||
|
||
/**
|
||
* electron-vite 构建配置
|
||
*
|
||
* 为什么不配置 renderer:
|
||
* 渲染层不由本工程构建——开发期直接加载 web-antd 的 vite dev server(http://localhost:14002),
|
||
* 生产期通过 app:// 自定义协议加载 web-antd 的生产 dist(electron-builder extraResources 拷入)。
|
||
*
|
||
* 为什么不用 externalizeDepsPlugin:
|
||
* 故意把 electron-updater / electron-log / electron-store 等运行时依赖全部打进 out/ 产物,
|
||
* 使应用的 dependencies 为空,electron-builder 无需收集 node_modules,
|
||
* 从而规避 pnpm 软链目录结构在打包期的兼容问题(asar 里只有 out/ 与 package.json)。
|
||
*/
|
||
export default defineConfig({
|
||
main: {
|
||
build: {
|
||
outDir: 'out/main',
|
||
},
|
||
},
|
||
preload: {
|
||
build: {
|
||
outDir: 'out/preload',
|
||
rollupOptions: {
|
||
output: {
|
||
// sandbox: true 的 preload 必须是 CommonJS(Electron 硬性限制),
|
||
// 这里锁定输出为 index.cjs,主进程按该文件名引用
|
||
format: 'cjs',
|
||
entryFileNames: '[name].cjs',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
});
|