question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using 'pg' in webpack to Electron return an error trying to requiring pg-native.

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

5reactions
charmandercommented, May 21, 2017

Does making pg/native part of externals in the webpack configuration work?

externals: [
    "pg/native",
],
0reactions
michaeljotacommented, Jun 22, 2022

Seems like this is the actual solution we need, so I’ll close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack import error with node-postgres ('pg'.Client)
The error above was thrown when attempting to run a Cypress test that required the npm package 'pg'. Attempting to install the pg-native...
Read more >
cypress-io/cypress - Gitter
My test has some setup code that uses the PG npm package and as such, Cypress is throwing that error when Webpack tries...
Read more >
Seeing error Module not found: 'pg-native' in heroku app-Reactjs
How to resolve module not found error in webpack/reactjs app? How to create React App including Web3 using create-react-app? I am getting Module...
Read more >
A Comprehensive Guide to Fixing Node-Gyp Issues on Windows
Try running npm install –no-optional to install only the required ... If you try to use a newer version of Python, you'll get...
Read more >
missing driver error typeorm - You.com | The search engine you ...
The whole package is built using Webpack, but whenever I try to connect to the ... other modules requiring "server modules" wrapped, like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found