Skip to content

refactor: replace loadEsmModule with dynamic import()#31539

Merged
alan-agius4 merged 1 commit intoangular:mainfrom
alan-agius4:refactor/dynamic-import
Oct 21, 2025
Merged

refactor: replace loadEsmModule with dynamic import()#31539
alan-agius4 merged 1 commit intoangular:mainfrom
alan-agius4:refactor/dynamic-import

Conversation

@alan-agius4
Copy link
Collaborator

The custom loadEsmModule helper function was a workaround to prevent TypeScript from downleveling dynamic imports to require() calls, which would fail to load ESM modules.

With modern TypeScript and Node.js versions, this workaround is no longer necessary. This commit removes the loadEsmModule utility and replaces all its usages with standard dynamic import() expressions.

This simplifies the codebase and relies on the native module loading capabilities of the environment.

@alan-agius4 alan-agius4 force-pushed the refactor/dynamic-import branch 3 times, most recently from fe08dd7 to 22f7ebc Compare October 21, 2025 09:09
@alan-agius4 alan-agius4 requested a review from clydin October 21, 2025 09:28
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release labels Oct 21, 2025
@alan-agius4 alan-agius4 marked this pull request as ready for review October 21, 2025 09:28
@alan-agius4 alan-agius4 force-pushed the refactor/dynamic-import branch from 22f7ebc to c3e25f9 Compare October 21, 2025 12:10
@alan-agius4 alan-agius4 requested a review from clydin October 21, 2025 12:10
@alan-agius4 alan-agius4 force-pushed the refactor/dynamic-import branch from c3e25f9 to 109141a Compare October 21, 2025 12:13
The custom `loadEsmModule` helper function was a workaround to prevent TypeScript from downleveling dynamic imports to `require()` calls, which would fail to load ESM modules.

With modern TypeScript and Node.js versions, this workaround is no longer necessary. This commit removes the `loadEsmModule` utility and replaces all its usages with standard dynamic `import()` expressions.

This simplifies the codebase and relies on the native module loading capabilities of the environment.
@alan-agius4 alan-agius4 force-pushed the refactor/dynamic-import branch from 109141a to 4e0a0f9 Compare October 21, 2025 12:16
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 21, 2025
@alan-agius4 alan-agius4 merged commit b356bb1 into angular:main Oct 21, 2025
31 checks passed
@alan-agius4 alan-agius4 deleted the refactor/dynamic-import branch October 21, 2025 13:05
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants