79731149

Date: 2025-08-10 10:26:19
Score: 1.5
Natty:
Report link

any updates on this?

The docs (https://node-postgres.com/apis/client) state:

"... example to create a client with specific connection information:

import { Client } from 'pg' ..."

But this leads to:

import { Client } from "pg";
         ^^^^^^
SyntaxError: Named export 'Client' not found. The requested module 'pg' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'pg';
const { Client } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:220:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:321:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)

Node.js v22.17.1
Reasons:
  • Blacklisted phrase (1): any updates on
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: HCZ