electron - 当我捆绑电子程序时,找不到路径中发生了一些错误;
问题描述
代码库是可以重现的在这里: https://github.com/xiaobindebingo/electron-app.git 我的想法是使用 tsc 编译来构建目录;然后将 package.json main配置为init.js,这需要('./build/main.js'); 它在开发中可以正常工作,但在捆绑应用程序中是错误的;当我启动捆绑的应用程序时;像这样有问题
- 包.json
{
"name": "ide",
"version": "1.0.0",
"description": "小程序开发工具",
"main": "init.js",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"lint": "eslint -c .eslintrc --ext .ts ./src",
"start": "yarn build && electron .",
"dist": "electron-builder"
},
"repository": {
"type": "git",
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^13.1.2",
"eslint": "^7.28.0",
"typescript": "^4.3.2",
"electron-builder": "^22.11.7"
"@typescript-eslint/eslint-plugin": "^4.26.1",
"@typescript-eslint/parser": "^4.26.1"
}
}
- 初始化.js
require('./build/main.js');
解决方案
推荐阅读
- jquery - 重复 Ajax 请求直到成功
- excel - 为 GUID 过滤 OData 查询在 PowerQueryEditor 中不起作用
- autodesk-forge - 如何使用 Autodesk Forge Viewer 在 PDF 文件中添加 Puspin
- javascript - 在执行 API 调用的 JavaScript foreach 循环内延迟
- java - 使用 tcp/ip 套接字的客户端-服务器中的争用或死锁
- mysql - 所有查询只读,除了一个
- hibernate - Wildfly 17 错误“WFLYMETRICS0003:无法读取属性 second-level-cache-hit-count”时启用了统计信息 =“true”
- javascript - 使用 scrollIntoView() 的向上/向下按钮
- java - 是否可以在不更改方法主体的情况下编译通用可变参数方法?
- sql - DB2 - 用于生成自定义长度为一个字符的字符串的 SQL 语法