Closed schulzf closed 2 months ago
Hi Felipe! Thanks for going ahead and opening this PR, but this is not the kind of contribution that's fit for a drive-by PR. Moving to ESM-only was a conscious decision, and there's enough workarounds for using SuperJSON from CommonJS. I appreciate your effort though!
Add Support for CommonJS via ESM & CJS Builds
Summary
This pull request implements dual builds for the SuperJSON library, adding support for both ECMAScript Modules (ESM) and CommonJS modules (CJS). This enhancement ensures compatibility with various JavaScript environments and module loaders, particularly focusing on improving integration with the NestJS framework.
Changes
package.json
to point to the correct module formats:"main"
field now points to the CJS build."module"
field now points to the ESM build.Motivation
This enhancement aims to facilitate seamless integration with the NestJS framework, which benefits from CommonJS module support.
Testing
Please review the changes and provide any feedback. Thank you!