Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ES module package entry point #1709

Merged
merged 2 commits into from Mar 15, 2023
Merged

Conversation

anniel-stripe
Copy link
Contributor

@anniel-stripe anniel-stripe commented Mar 14, 2023

Summary

Convert stripe-node to a dual package supporting both CommonJS and ES Modules.

Follow-up to #1704

Testing

In addition to our test projects from CI, I've run manual test projects to verify they work as before, and that they use the correct entry point. Verified the following:

  • Works with CommonJS require const Stripe = require('stripe') and const {Stripe} = require('stripe'))
  • Works with ES module import (import Stripe from 'stripe' and import {Stripe} from 'stripe')
    • TypeScript, plain JS
    • Node and worker targets
  • CJS / ESM entrypoints bundle successfully with esbuild and webpack for node and browser targets
  • Type hints still work in IDE

Changelog

@anniel-stripe anniel-stripe marked this pull request as ready for review March 15, 2023 18:54
Copy link
Contributor

@pakrym-stripe pakrym-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@anniel-stripe anniel-stripe changed the title Add separate ESM entry point Add support for ES modules Mar 15, 2023
@anniel-stripe anniel-stripe changed the title Add support for ES modules Add ES module package entry point Mar 15, 2023
@anniel-stripe anniel-stripe merged commit 50f541a into master Mar 15, 2023
@anniel-stripe anniel-stripe deleted the anniel-esm-entrypoint branch March 15, 2023 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants