Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
SongFengYunHe
WebNovelTranslator
Repository navigation
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
WebNovelTranslator
/
electron-builder.offline.config.js
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
46 lines (41 loc) · 2.1 KB
main
Breadcrumbs
WebNovelTranslator
/
electron-builder.offline.config.js
Copy path
Top
File metadata and controls
Code
Blame
46 lines (41 loc) · 2.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* 「离线版」打包配置:在标准版基础上额外分发离线推理引擎。
*
* 与标准版的差异只有三处:
* 1. 不再排除引擎包,一并打入 app.asar;
* 2. 裁掉引擎包中与 Windows x64 运行无关的部分(名单见 scripts/packaging-shared.js);
* 3. 产物名带 -Offline,输出到 release-offline/,可与标准版同时构建、对比体积。
*
* appId 与 productName 刻意与标准版保持一致,因此:
* - 两个版本共用同一份设置、术语表与历史记录(userData 目录相同);
* - 先装标准版再装离线版等于覆盖升级,反之亦然。
* 也就是说:**两个安装包二选一,不要同时安装。** 这是有意为之——分成两个
* appId 会让用户换版本时丢掉全部数据。
*/
const base = require('./electron-builder.config.js');
const { buildFiles } = require('./scripts/packaging-shared.js');
module.exports = {
...base,
// 独立输出目录,便于与标准版并存,也便于对比两者体积。
directories: { ...base.directories, output: 'release-offline' },
// 离线版把「排除引擎」换成「包含引擎 + 裁掉引擎内与 Win x64 无关的部分」,
// 其余通用排除项(编译期源码、测试、示例)两版一致。
files: buildFiles({ includeEngine: true }),
asarUnpack: [
...base.asarUnpack,
// 原生 .node / .dll 无法从 asar 内加载,必须解包。
'node_modules/onnxruntime-node/bin/**',
// sharp 的预编译二进制同理。
'node_modules/@img/**',
// `@xenova/transformers` 是 ESM 包(type: module,main 指向 src/transformers.js),
// 而 Node 的 ESM 加载器不经过 Electron 的 asar 补丁——留在 asar 内会导致
// `import('@xenova/transformers')` 直接失败。必须解包成真实文件。
// `@huggingface/jinja` 同为 type: module,一并解包(体积可忽略)。
'node_modules/@xenova/transformers/**',
'node_modules/@huggingface/jinja/**',
],
nsis: {
...base.nsis,
artifactName: '${productName}-Offline-Setup-${version}.${ext}',
},
};
You can’t perform that action at this time.