Closed
Description
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
- Debugging in VSCode https://code.visualstudio.com/docs/editor/debugging
- Conditional Exports in Node.js https://nodejs.org/api/packages.html#packages_conditional_exports