I have a NodeJS project where I implemented a Ledger sign functionality.
This project is created as a library and can be used standalone as a Node app, or with npm imported in an Angular Web Application.
In my file where I try to connect to the Ledger Device, I import both TransportNodeHID and TransportWebHID and I try to connect to the one that work for current context dynamically.
The problem is when I import this project (as a dependency in the package.json) in my Angular App.
There is something Node specific in TransportNodeHid because I receive at application startup: 'require is not defined')
If I remove TransportNodeHid from the file everything works. What should be the way to go here so I can have this project handling both NodeJS and browser?
Thank you!
Hello!
Description
I have a NodeJS project where I implemented a Ledger sign functionality. This project is created as a library and can be used standalone as a Node app, or with npm imported in an Angular Web Application.
In my file where I try to connect to the Ledger Device, I import both TransportNodeHID and TransportWebHID and I try to connect to the one that work for current context dynamically.
Code sample
The Problem
The problem is when I import this project (as a dependency in the package.json) in my Angular App. There is something Node specific in
TransportNodeHid
because I receive at application startup: 'require is not defined')If I remove TransportNodeHid from the file everything works. What should be the way to go here so I can have this project handling both NodeJS and browser? Thank you!