Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoist function exports to top of module body in CJS/AMD/UMD #57669

Merged
merged 2 commits into from
Mar 6, 2024
Merged

Conversation

rbuckton
Copy link
Member

@rbuckton rbuckton commented Mar 6, 2024

This changes our emit for CommonJS, AMD, and UMD so that exports for exported function declarations are hoisted to the top of the transformed module body. There is a minor impact on the order of keys in the exportedNames_1 map synthesized for SystemJS modules as a consequence of this change, but it has no impact to runtime behavior.

Fixes #39853

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Mar 6, 2024
@jakebailey
Copy link
Member

I just merge conflicted this via #57668; you'll have to merge main to delete some of these baselines. (sorry!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hoisted function declarations should be assigned to exports before any require calls
4 participants