How to add folders and files to electron build using electron-builder(如何使用电子生成器将文件夹和文件添加到电子构建)
问题描述
我正在创建一个运行从 create-react-app 生成的反应的电子.然后我添加 nedbjs(一个持久性数据库)和 camojs(用于 nedb 的 ODM)作为依赖项.要与 nedb 连接反应,我使用电子 ipc.
I am creating an electron which running react generated from create-react-app. Then i add nedbjs(a persistence database) and camojs(ODM for nedb) as dependency. To connect react with nedb i use electron ipc.
这是我的项目结构:
这是我的 package.json:
And here is my package.json:
我使用命令 yarn electron-pack 来打包我的应用程序.然后从 dist 文件夹运行解压后的可执行文件然后得到这个错误:
I use command yarn electron-pack to package my app. And then running the unpacked executable from dist folder then got this error:
这里是 我的仓库
推荐答案
要在您的电子构建文件夹中添加文件或文件夹,您可以在 package.json 中添加 extraFiles 选项.这是一个复制凭据"目录的示例:
To add a file or folder on your electron build folder, you can add the extraFiles options on package.json. Here is an example to copy a "credential" directory:
然后
希望对你有帮助
这篇关于如何使用电子生成器将文件夹和文件添加到电子构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!