Skip to content

Fix ESM dist export packaging#61

Open
ubinatus wants to merge 1 commit intopaypal:mainfrom
ubinatus:issue-59-esm-export-fix
Open

Fix ESM dist export packaging#61
ubinatus wants to merge 1 commit intopaypal:mainfrom
ubinatus:issue-59-esm-export-fix

Conversation

@ubinatus
Copy link
Copy Markdown

Summary

  • update the build to run the ESM and CJS compiles sequentially
  • write package.json files into dist/esm and dist/cjs so Node resolves each output with the correct module type
  • add a verify:dist step to confirm named exports are available from both published entrypoints

Why

This fixes #59, where enums such as CaptureStatus were exported from source but not available to ESM consumers at runtime.

Test plan

  • Run npm install
  • Run npm run build
  • Verify import { OrderStatus, CaptureStatus } from '@paypal/paypal-server-sdk' works in an ESM Node run
  • Verify require('@paypal/paypal-server-sdk') still works in CommonJS

Mark the built ESM and CJS outputs with package manifests and verify both entrypoints expose named exports. This keeps Node from treating the import target as CommonJS and catches packaging regressions during build.
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.

SyntaxError: The requested module '@paypal/paypal-server-sdk' does not provide an export named 'xxxx'

1 participant