我在 Electron 项目的工作目录中名为data的目录中有一些 JSON 文件。我使用electron-build以下配置 (package.json)成功构建了应用程序。
{
"name": "My App",
"version": "0.0.9",
"description": "TEST DESC",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "build --dir",
"dist": "build"
}
"author": "Test",
"license": "CC0-1.0",
"build": {
"appId": "test.tester.test",
"directories": {
"app": ""
},
"extraFiles": [
"data"
],
"dmg": {
"contents": [
{
"x": 110,
"y": 150
},
{
"x": 240,
"y": 150,
"type": "link",
"path": "/Applications"
}
]
},
"win": {
"target": "squirrel",
"icon": "build/icon.ico"
}
},
"devDependencies": …Run Code Online (Sandbox Code Playgroud)