Native node.js addons only loaded in main.ts (entrypoint)
See original GitHub issueWhen trying to load native addons in components or services there is a problem with bindings, the error is:
Error: Could not load the bindings file. (and the tried paths)
the .node file is in the correct path, but the bindings module can’t find it (I don’t know why).
Sample code working on main.ts and not in any other place in the application:
const addon = require('bindings')('addon.node'); console.log('This should be eight:' + addon.add(3, 5));
On the other hand, when doing the same thing in the main.ts (project entry point) of the application, the bindings are working like a charm.
It could be possible to solve this issue if some kind of webpack configuration provided? By the way, in this boilerplate, where is the webpack configuration file??? I can’t find it.
How is this possible? Please any help will be welcomed! Thanks in advance!!!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top GitHub Comments
@renatop7 this is my electron service, used electorn-angualr seed which explains this part. so any native node module you want to use should be imported here, then you can inject this
ElectronService
in any other service who needs the native modules, likeEdcComService
.@shaniqwa very nice! thanks!