Skip to content

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

@ubinatus

Description

@ubinatus

Issue Summary

The CaptureStatus enum is not properly exported when using the @paypal/paypal-server-sdk package in an ESM project ("type": "module"), even though it IS defined in the source code.

Description

When using @paypal/paypal-server-sdk in an ESM project with "type": "module" in package.json, importing CaptureStatus fails with:

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

However, the source code at src/index.ts line 97 clearly exports it:

export { CaptureStatus } from './models/captureStatus.js';

Environment

  • SDK Version: 2.2.0
  • Node.js Version: v24.12.0
  • Package Manager: pnpm 10.28.1
  • Module Type: ESM ("type": "module" in package.json)

Code to Reproduce

// In an ESM project (package.json has "type": "module")
export { OrderStatus, CaptureStatus } from '@paypal/paypal-server-sdk';

Expected Behavior

Both OrderStatus and CaptureStatus should be importable from the package.

Actual Behavior

Only OrderStatus imports successfully. CaptureStatus throws:

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

Analysis

The package's package.json defines:

{
  "main": "dist/cjs/index.js",
  "module": "dist/esm/index.js",
  "exports": {
    ".": {
      "import": {
        "types": "./dist/esm/types/index.d.ts",
        "default": "./dist/esm/index.js"
      },
      "require": {
        "types": "./dist/cjs/types/index.d.ts",
        "default": "./dist/cjs/index.js"
      }
    }
  }
}

The ESM build at dist/esm/index.js appears to be missing some exports that exist in the source. This could be a build configuration issue with tsconfig.esm.json or the build script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions