leinelissen / embedded-postgres

🐘 A Node package that allows you to spawn a Postgresql cluster programatically.
MIT License
53 stars 10 forks source link

EmbeddedPostgres is not a constructor #2

Closed buymed-thanhdao closed 1 year ago

buymed-thanhdao commented 1 year ago

I liked introducing it on the Readme and got an error like the one below. Screenshot 2023-04-13 at 15 21 14

but when I do like the below it works. Screenshot 2023-04-13 at 15 23 26

Screenshot 2023-04-13 at 15 23 51

leinelissen commented 1 year ago

Hey @xthanhx, thanks for reporting the issue, I managed to reproduce it. The problem is with how Typescript compiles ESM to CJS modules. I have made a small change, which now results in the right export qualifier (module.exports). That release is on its way to NPM, and you should be able to install it with npm i embedded-postgres@latest. You should then be able to import the package with import EmbeddedPostgres from 'embedded-postgres'; as expected.