Hi!
I'm trying to use this bundled with webpack to be used in electron. But it tries to import the pg-native module. I really don't know how to use the native binding in Electron, but at least I would like to be able to use the plain JS driver.
I read #127 and #838, and commenting the lines mentioned here makes the package works, but I see this most like a workarround. The problem it's not gone, just hided.
Thanks!
EDIT: You can test this here
npm run build:electron
Main and Renderer process will be packaged in separated files. The Renderer part will be packaged correctly, but when it tries to bundle the Main part the error will be thrown.
aaaaaaaaaaand its still not. Nor can I find any workarounds :(
@rozzzly for workarounds you can comment some lines as I said in the description.
Does making pg/native part of externals in the webpack configuration work?
externals: [
"pg/native",
],
Just tested @charmander solution with Electron, having suffered from the same issue like @michaeljota, works great! I think this should be noticed in the docs and this issue can be closed.
As of pg 8.2.1, I am using this webpack config workaround, which hopefully most can stomach until a permanent fix is released:
https://github.com/brianc/node-postgres/issues/838#issuecomment-405646013
The other thing to keep in mind is that you mustn't run postgres queries from a renderer process.
Most helpful comment
Does making
pg/nativepart ofexternalsin the webpack configuration work?