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

esm: bypass CJS loader in default load under --default-type=module #50004

Merged
merged 4 commits into from
Nov 10, 2023

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Oct 1, 2023

This allows user to opt-out from using the monkey-patchable CJS loader to load CJS modules.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Oct 1, 2023
Copy link
Member

@GeoffreyBooth GeoffreyBooth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. I would maybe rephrase the PR description though, I think this more a continued expansion of the behavior of --default-type to mean “in module mode, the ESM loader is the only loader in use” which is what we want and was part of the proposal.

});
});

it('should affect CJS .js files', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CJS .js files . . . that are required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that are required, imported, or used as entry point

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth spelling that out, I was assuming “CJS .js files” meant .js files required by CommonJS modules, rather than what I now presume you meant, “.js file that is interpreted as CommonJS.”

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 27, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 27, 2023
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 9, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 9, 2023
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 merged commit 0dfc59e into nodejs:main Nov 10, 2023
56 checks passed
@aduh95
Copy link
Contributor Author

aduh95 commented Nov 10, 2023

Landed in 0dfc59e

@aduh95 aduh95 deleted the bypass-cjs branch November 10, 2023 08:21
targos pushed a commit that referenced this pull request Nov 11, 2023
This allows user to opt-out from using the monkey-patchable CJS loader,
even to load CJS modules.

PR-URL: #50004
Reviewed-By: Geoffrey Booth <[email protected]>
targos pushed a commit that referenced this pull request Nov 14, 2023
This allows user to opt-out from using the monkey-patchable CJS loader,
even to load CJS modules.

PR-URL: #50004
Reviewed-By: Geoffrey Booth <[email protected]>
UlisesGascon pushed a commit that referenced this pull request Dec 11, 2023
This allows user to opt-out from using the monkey-patchable CJS loader,
even to load CJS modules.

PR-URL: #50004
Reviewed-By: Geoffrey Booth <[email protected]>
@UlisesGascon UlisesGascon mentioned this pull request Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants