小编tpi*_*chu的帖子

使用电子生成器将文件夹和其中的文件包含到电子构建中?

我在 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)

javascript node.js electron electron-builder

6
推荐指数
1
解决办法
5429
查看次数

如何在应用商店发布 Electron 应用?

我已将应用程序打包为 mas 文件以上传到 App Store。但

  1. 从 Xcode 11 开始,它们不再提供应用程序加载器
  2. Electron 不生成 XCode 项目。

在这种情况下,最好的解决方案是什么?

javascript macos xcode electron electron-builder

5
推荐指数
1
解决办法
3012
查看次数

Electron JS - 无法解构“require(...).remote”的属性“BrowserWindow”,因为它未定义

这是在渲染器进程中:


const {BrowserWindow} = require('electron').remote

const path = require('path')
const url = require('url')

const newWindowButton = document.getElementById('new-window-btn');
newWindowButton.addEventListener('click',(e)=>{
    let win3 = new BrowserWindow();
    win3.loadURL(url.format({
        pathname: path.join(__dirname,'index3.html'),
        protocol: "file",
        slashes: true
    }))

})
Run Code Online (Sandbox Code Playgroud)

我无法在渲染器进程中打开一个新窗口,出现以下错误。

**未捕获的类型错误:无法按原样解构 'require(...).remote' 的属性 'BrowserWindow'

undefined.**
    at Object.<anonymous> (D:\ElectronTute\helloWorld\index1.js:4)
    at Object.<anonymous> (D:\ElectronTute\helloWorld\index1.js:21)
    at Module._compile (internal/modules/cjs/loader.js:1145)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js`enter code here`:1166)
    at Module.load (internal/modules/cjs/loader.js:981)
    at Module._load (internal/modules/cjs/loader.js:881)
    at Function.Module._load (electron/js2c/asar.js:769)
    at Module.require (internal/modules/cjs/loader.js:1023)
    at require (internal/modules/cjs/helpers.js:77)
    at index1.html:13
Run Code Online (Sandbox Code Playgroud)

javascript node.js electron

4
推荐指数
1
解决办法
4160
查看次数

标签 统计

electron ×3

javascript ×3

electron-builder ×2

node.js ×2

macos ×1

xcode ×1