cordova-electron icon indicating copy to clipboard operation
cordova-electron copied to clipboard

Cordova electron is not packaging the dependencies

Open mhammad-extron opened this issue 1 year ago • 5 comments

I'm currently working on a Cordova Angular application that utilizes the Electron platform. As part of the project, I've integrated a library named "event-pubsub.". The installed library is in node_modules folder.

I have also written a custom Cordova Electron plugin, named "tcp-plugin," where I am importing the above library:

var Events = self.require('event-pubsub');

To include this plugin in the Cordova Angular project, I used the following command:

cordova plugin add tcp-plugin

Building the project with ng build worked without any issues, and I can successfully build the Electron app as well using:

cordova build electron

However, upon running the packaged Electron executable file from /platform/electron/build/, I encounter a plugin-related error:

Module not found: event-pubsub

I would appreciate any assistance in resolving this issue.

[email protected] [email protected] [email protected] [email protected] OS: Windows

mhammad-extron avatar Sep 27 '23 21:09 mhammad-extron

Hello @mhammad-extron , did you find a solution about this problem ? I have the same issue here with the library serialport, on windows 10, 11 and ubuntu 22.04.

laux98 avatar Oct 11 '23 08:10 laux98

@laux98 Sorry, I havent found the solution yet.

mhammad-extron avatar Oct 19 '23 11:10 mhammad-extron

Unfortunately, after few days of researchs, I don't find a solution about this problem. So, for my project, I decided to switch on electron (not cordova-electron) for using serial port and this work this way, but I can't find a solution about using serialport with cordova-electron ...

laux98 avatar Oct 19 '23 11:10 laux98

@mhammad-extron take a look at this comment: https://github.com/apache/cordova/discussions/439#discussioncomment-7309259

It might point you into the right direction.

erisu avatar Oct 19 '23 14:10 erisu

@mhammad-extron What can you use NodeJS API in cordova-electron ? I use require('electron'); console tips error: require is not defined

CHHHAN avatar May 23 '24 06:05 CHHHAN