0
votes

I was using this repo with Node.js: https://www.npmjs.com/package/pg-essential

But now, with NestJS I'm having problems to make the import properly. The original lines are:

var pg = require('pg');
require('pg-essential').patch(pg);

And using NestJS I can use: import * as pg from 'pg';

for the pg require, but how can import the second require?

1

1 Answers

0
votes

You could do

import { patch } from 'pg-essential';
patch(pg);

Importing a named exporting and calling the function, instead of doing a chained require function.