Skip to content

A Node.js application written in ESM uses CommonJS distribution of the SDK #2900

Closed
@trivikr

Description

@trivikr

Is your feature request related to a problem? Please describe.

A Node.js application written in ESM uses CommonJS distribution of the SDK.

Example code:

// index.mjs
import { DynamoDB } from "@aws-sdk/client-dynamodb";

const client = new DynamoDB({});
await client.listTables({});
  • In VSCode, add a breakpoint on the line which calls listTables.
  • Click on "Run and Debug" in the Debugging View to start debugging.
  • The debug session will break at listTables.
  • Click on "Step Into" debug action.
  • Note that debug session steps into node_modules/@aws-sdk/property-provider/dist-cjs/chain.js

It uses distribution in dist-cjs and not in dist-es

Screen recording
StepThroughMJS.mov

Describe the solution you'd like

The Node.js application written in ESM should use distribution in dist-es
The Node.js application written in ESM should use folder in dist-node-esm (UPDATE April 2022)

Describe alternatives you've considered

A different distribution for Node.js ESM, which can be take up while implementing Node.js specific distributions in #2889 to avoid increasing install size.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature or enhancement. May require GitHub community feedback.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions