-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require in non-babel env needs .default suffix #12
Comments
Hi @Khasanboy, I addressed the problem. It is caused by Babel If you use Babel transpiler (with ES6 modules support) for you app code too, you can import it like Otherwise you must use I know, that's not very intuitive. Thank you very much for drawing my attention to this problem. I'll prepare a solution (maybe using babel-plugin-add-module-exports and add info to docs. To this problem:
Node Native modules must be built with the correct version of Node.js, in which they will be used. So, if you install this library with npm, it is built with your machine's Node.js version. But then, you are using the library in Electron and Electron uses its own version of Node.js internally. So after installing a library with Node Native Module, you must rebuild the source with correct Electron headers. The usage with Electron is described in README FAQs section Can I use this library in my Electron app?. Hope it helps. |
Thanks, This fixed the problem |
Remove unused babel presets Add .travis.yml BC: Remove default export and move exports to index.js (see #12)
Solved, but introduced a breaking change, see How do I require/import this library? in README. |
I am trying to create application using Electron. In the beginning I was getting problem with node Module versions that was expecting 51 but required 53. I installed Electron 1.5.1 and that error is fixed but now I am getting error that says:
TypeError: NFC is not a constructor
I just used your example and error is coming from this line:
const nfc = new NFC();
did I miss something or is it about node native modules ?
Thanks in advance
The text was updated successfully, but these errors were encountered: