Closed davejm closed 8 years ago
@bradstewart
Hey I'm sure you're a busy guy. Just thought I'd drop a comment here in case anyone else was struggling with including native node modules in their apps. So I put the serialserver dependency in the app/package.json where it should be. I also went to the original electron boilerplate and copied its rebuild native dependencies script from the tasks dir, and appended a call to this to the postinstall command in the root package.json. Also had to manually remove ('bindings') from the require in serialport/lib/bindings.js. Now it works. Anyone wanting details just hit me up. I might create a PR to include the rebuild native modules script in this boilerplate as currently there's no built-in way to ship native deps. Thanks
Hi! I still cannot resolve how to use serialport with webpack (electron-boilerplate-vue). I checked that if I use serialport in electron.js file it works. On the other hand every require for serialport in renderer process gives error:
"Could not locate the bindings file"
. Removing ('bindings')
part doesn't help because it is required for serialport list function (sp.list(function(err, ports) {}))
Hi, I'm trying to use p5.serialserver - https://github.com/vanevery/p5.serialport (which requires serialport - a native module) in the app but am getting this error in the webpack build
I looked at the offending lines of code and the module's purpose seems to be to dynamically require binary modules by try a bunch of directories until it gets it.
Then when I try to use serialport in the app (main proces) I get this runtime error
I was able to solve this by moving serialport to my externals in webpack config and moving the dependency from app/package.json deps to the root package.json devDeps but I think this is wrong as it is a runtime dependency and the packaged app needs the relevant builds.
I've tried using node-loader as per https://github.com/webpack/webpack/issues/1040. Not sure if the solution involves some use of webpack's ContextReplacementPlugin.
Any thoughts? Thanks :)
Edit - I was able to get much more informative errors by changing the devtool setting in webpack.dev-background.conf.js and webpack.dev-main.conf.js from '#eval-source-map' to '#source-map'