简介
ee-bin 的完整默认配置值。用户提供 ./cmd/bin.js 的配置会与这些默认值深度合并,因此用户值始终覆盖对应的默认字段。
dev
dev.frontend
| 字段 | 默认值 | 说明 |
|---|---|---|
directory | './frontend' | 前端目录 |
cmd | 'npm' | 命令 |
args | ['run', 'dev'] | 参数 |
protocol | 'http://' | 前端开发服务器协议 |
hostname | 'localhost' | 前端开发服务器主机名 |
port | 8080 | 前端开发服务器端口 |
indexPath | 'index.html' | 首页文件名 |
force | false | 强制刷新 |
sync | false | 同步模式 |
dev.electron
| 字段 | 默认值 | 说明 |
|---|---|---|
directory | './' | Electron 目录 |
cmd | 'electron' | 命令 |
args | ['.', '--env=local'] | 参数 |
loadingPage | '/public/html/loading.html' | 加载页路径 |
watch | false | 监听文件变更 |
sync | false | 同步模式 |
delay | 1000 | 监听模式的防抖延迟(毫秒) |
build
build.frontend
| 字段 | 默认值 | 说明 |
|---|---|---|
directory | './frontend' | 前端目录 |
cmd | 'npm' | 命令 |
args | ['run', 'build'] | 参数 |
build.electron (BundleConfig)
| 字段 | 默认值 | 说明 |
|---|---|---|
bundleType | 'bundle' | 打包模式('bundle' = esbuild 单文件打包,'copy' = 目录复制) |
external | [] | 用户自定义的 esbuild 外部依赖 |
sourcemap | false | 自动:开发→inline,生产→关闭 |
minify | false | 压缩代码 |
keepNames | false | 保留函数/类名 |
drop | [] | 要移除的语句 |
legalComments | 'none' | License 注释处理方式 |
define | {} | 编译时常量 |
copy | [] | 从 electron/ 中额外复制的文件/目录 |
format | 'cjs' | 输出格式 |
build.platforms
| 平台键 | 默认命令 | 默认参数 |
|---|---|---|
win32 | electron-builder | ['--config=./cmd/builder.json', '-w=nsis', '--ia32'] |
win64 | electron-builder | ['--config=./cmd/builder.json', '-w=nsis', '--x64'] |
win_e | electron-builder | ['--config=./cmd/builder.json', '-w=portable', '--x64'] |
win_7z | electron-builder | ['--config=./cmd/builder.json', '-w=7z', '--x64'] |
mac | electron-builder | ['--config=./cmd/builder-mac.json', '-m'] |
mac_arm64 | electron-builder | ['--config=./cmd/builder-mac-arm64.json', '-m', '--arm64'] |
linux | electron-builder | ['--config=./cmd/builder-linux.json', '-l=deb', '--x64'] |
linux_arm64 | electron-builder | ['--config=./cmd/builder-linux.json', '-l=deb', '--arm64'] |
所有平台配置默认 directory: './'。
move
| 键 | 默认 src | 默认 dest |
|---|---|---|
frontend_dist | './frontend/dist' | './public/dist' |
start
| 字段 | 默认值 | 说明 |
|---|---|---|
directory | './' | 目录 |
cmd | 'electron' | 命令 |
args | ['.', '--env=prod'] | 参数 |
encrypt
encrypt.frontend
| 字段 | 默认值 | 说明 |
|---|---|---|
type | 'none' | 加密类型 |
files | ['./public/dist/**/*.js'] | 待加密文件 |
fileExt | ['.js'] | 要处理的扩展名 |
cleanFiles | ['./public/dist'] | 加密后要清除的目录 |
specificFiles | [] | 强制使用混淆的文件 |
encryptDir | './' | 基准目录 |
silent | false | 抑制横幅 |
前端 confusionOptions 默认值:
| 选项 | 默认值 | 说明 |
|---|---|---|
compact | true | 移除换行 |
stringArray | true | 将字符串移至数组 |
stringArrayEncoding | ['none'] | 无编码(前端对性能敏感) |
deadCodeInjection | false | 无死代码 |
stringArrayCallsTransform | true | 转换调用 |
numbersToExpressions | true | 替换数字 |
target | 'browser' | 浏览器运行环境 |
encrypt.electron
| 字段 | 默认值 | 说明 |
|---|---|---|
type | 'none' | 加密类型 |
files | ['./public/electron/**/*.js'] | 待加密文件 |
fileExt | ['.js'] | 要处理的扩展名 |
cleanFiles | ['./public/electron'] | 加密后要清除的目录 |
specificFiles | ['./public/electron/preload/bridge.js'] | 强制使用混淆的文件 |
entryFiles | ['./public/electron/main.js'] | 保持 .js 格式的入口文件 |
encryptDir | './' | 基准目录 |
silent | false | 抑制横幅 |
Electron confusionOptions 默认值:
| 选项 | 默认值 | 说明 |
|---|---|---|
compact | true | 移除换行 |
stringArray | true | 将字符串移至数组 |
stringArrayEncoding | ['rc4'] | RC4 加密(Electron 端更强的加密) |
deadCodeInjection | false | 无死代码 |
stringArrayCallsTransform | true | 转换调用 |
numbersToExpressions | true | 替换数字 |
target | 'node' | Node 运行环境 |
Electron bytecodeOptions 默认值:
| 选项 | 默认值 | 说明 |
|---|---|---|
electron | true | 为 Electron V8 生成字节码 |
exec
默认:{}(空 — 用户在 ./cmd/bin.js 中自定义命令)
