How to add a custom made native dependency
I am looking for some documentation on how to add a native dependency. I created an example here https://github.com/BiancoA/electron-webpack-quick-start-nm and asked a https://stackoverflow.com/questions/46930628/attempting-to-link-a-native-module-using-electron-webpack stackoverflow question.
I compiled my .node module using node-gyp and now I would like to use it from electron, but I get:
Error: Cannot find module 'mymoduleND'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (/Users/bianco/Src/electron-webpack-quick-start-nm/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at eval (webpack-internal:///mymoduleND:1:18)
at Object.mymoduleND (/Users/bianco/Src/electron-webpack-quick-start-nm/dist/main/main.js:748:1)
at __webpack_require__ (/Users/bianco/Src/electron-webpack-quick-start-nm/dist/main/main.js:655:30)
at fn (/Users/bianco/Src/electron-webpack-quick-start-nm/dist/main/main.js:65:20)
at Object.eval (webpack-internal:///./src/main/index.js:4:69)
some help or some documentation? Thanks!
I found a solution to the problem using yarn link: https://yarnpkg.com/lang/en/docs/cli/link/
here I saved the working project: https://github.com/BiancoA/electron-webpack-quick-start-nm
If someone wants to review it and check if there are other possible ways, or correct any mistake I probably made, I'd be more than happy
I believe using yarn link is a required step to make this work and should do what you need it to.