Skip to content

fix(scripts/compilation): set dynamicImportInCjs: false to restore Jest compatibility#7899

Open
cjkesler wants to merge 1 commit intoaws:mainfrom
cjkesler:fix/7420-dynamicImportInCjs-jest
Open

fix(scripts/compilation): set dynamicImportInCjs: false to restore Jest compatibility#7899
cjkesler wants to merge 1 commit intoaws:mainfrom
cjkesler:fix/7420-dynamicImportInCjs-jest

Conversation

@cjkesler
Copy link
Copy Markdown

Description

Rollup (introduced in #7406) leaves dynamic import() calls in the dist-cjs output by default.
This broke Jest tests everywhere that uses @aws-sdk/* packages (especially credential providers) with the error:

A dynamic import callback was invoked without --experimental-vm-modules

See issue #7420.

This PR restores the old esbuild behavior by setting dynamicImportInCjs: false in scripts/compilation/Inliner.js.

Testing

  • Ran yarn turbo run build --filter=@aws-sdk/credential-provider-node...
  • Verified grep -r "import(" packages-internal/credential-provider-node/dist-cjs/ returns no matches
  • Ran scoped tests: yarn turbo run test --filter=@aws-sdk/credential-provider-node → all passing

No client code or generated files were changed, so no yarn generate-clients was needed.

Related Issues

…st compatibility

Rollup (introduced in aws#7406) leaves dynamic import() calls in CJS output by default.
This caused Jest tests to break with "dynamic import callback" errors (see aws#7420).

Re-adding dynamicImportInCjs: false restores the previous esbuild behavior.

Tested with:
- yarn turbo run build --filter=@aws-sdk/credential-provider-node...
- Confirmed no dynamic import() remains in dist-cjs
- Scoped tests pass
@cjkesler cjkesler requested a review from a team as a code owner March 29, 2026 04:24
@ork-acro
Copy link
Copy Markdown

ork-acro commented Apr 9, 2026

any update when its gonna merge?
@cjkesler

@cjkesler
Copy link
Copy Markdown
Author

cjkesler commented Apr 9, 2026

@ork-acro no idea, I'll happily merge once I am able to, I need an approving review from a reviewer with write access.

@trivikr trivikr requested a review from kuhe April 9, 2026 17:34
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.

@aws-sdk/client-s3 TypeError: A dynamic import callback was invoked without --experimental-vm-modules in jest

3 participants