josdejong / lossless-json

Parse JSON without risk of losing numeric information
MIT License
430 stars 28 forks source link

fix: adjust published module types #248

Closed penovicp closed 1 year ago

penovicp commented 1 year ago

Hi @josdejong, I noticed an issue when attempting to import lossless-json into a commonjs module, a TS1479 error is raised (The current file is a CommonJS module ... the referenced file is an ECMAScript module ...).

A minimal repo that can reproduce the issue can be found here. Running npm run build && npm start should log twice, once for the cjs and once for the esm build, instead the mentioned error occurs.

This PR restructures the published module types by moving the esm type from the root of the library to the esm subfolder.

josdejong commented 1 year ago

Thanks again! Merged and published in v2.0.11 now