fix(scripts/compilation): set dynamicImportInCjs: false to restore Jest compatibility#7899
Open
fix(scripts/compilation): set dynamicImportInCjs: false to restore Jest compatibility#7899
Conversation
…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
AzinInALoop
approved these changes
Apr 2, 2026
|
any update when its gonna merge? |
Author
|
@ork-acro no idea, I'll happily merge once I am able to, I need an approving review from a reviewer with write access. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Rollup (introduced in #7406) leaves dynamic
import()calls in thedist-cjsoutput by default.This broke Jest tests everywhere that uses
@aws-sdk/*packages (especially credential providers) with the error:See issue #7420.
This PR restores the old esbuild behavior by setting
dynamicImportInCjs: falseinscripts/compilation/Inliner.js.Testing
yarn turbo run build --filter=@aws-sdk/credential-provider-node...grep -r "import(" packages-internal/credential-provider-node/dist-cjs/returns no matchesyarn turbo run test --filter=@aws-sdk/credential-provider-node→ all passingNo client code or generated files were changed, so no
yarn generate-clientswas needed.Related Issues