简体   繁体   English

如何在Electron-builder中使用相对路径包含Node.js模块

[英]How to include a Node.js module using a relative path with Electron-builder

So basically a have a Node.js module that is required using: 因此,基本上有一个Node.js模块需要使用:

var parse = require("csv-parse/lib/sync");

The problem is that when my project is built with Electron-Builder and NSIS, the module cannot be found. 问题是,当我的项目是用Electron-Builder和NSIS构建的时,找不到该模块。 Likely due to the file path being completely different after the project is packaged and build. 可能是由于打包和构建项目后文件路径完全不同。

Listing it as a dependency doesn't help. 将其列为依赖项没有帮助。

What's the best way to solve this issue? 解决此问题的最佳方法是什么?

I don't know if this is what you're looking for but Webpack would resolve that issue. 我不知道这是否是您要寻找的东西,但Webpack将解决该问题。 Or you could try eletron-forge which uses eletron-compile. 或者你可以尝试eletron锻它采用eletron编译。 I've used electron-forge in the passed and it works great 我在过去使用过电子伪造,效果很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM