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

feat(swc/transform_module): support local scoped amd require #4726

Closed
wants to merge 2 commits into from

Conversation

kwonoj
Copy link
Member

@kwonoj kwonoj commented May 20, 2022

Description:
PR attempts to close #4718. Following logics to exports, PR attempts to inject local scoped require for the modules.

This PR mimics what tsc does (https://www.typescriptlang.org/play?jsx=0&module=2#code/KYDwDg9gTgLgBAMwK4DsDGMCWEVwEYQQAUAlHAN4C+QA) which shadows global cjs require entirely, instead of trying to apply private ident to existing require inside of module. This also reduces mutation to all of idents to callexpr, and we can short-curcuit visitor as soon as find first ident to callexpr.

BREAKING CHANGE:

Related issue (if exists):

@kwonoj kwonoj closed this May 20, 2022
@kwonoj kwonoj deleted the feat-amd-scoped-require branch May 20, 2022 23:51
@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

AMD generated code misses local require-function
1 participant