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

module: fix $ pattern replacements #40044

Closed

Conversation

guybedford
Copy link
Contributor

This fixes the bug where import 'pkg/$$.js' will resolve to pkg/$.js when using the exports pattern *.js -> *.js, due to the JS String replace DSL footgun (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter).

Thanks to @Rich-Harris for sharing this one on Twitter - https://twitter.com/Rich_Harris/status/1435703344354451458.

@nodejs/modules

@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 Sep 8, 2021
lib/internal/modules/esm/resolve.js Outdated Show resolved Hide resolved
lib/internal/modules/esm/resolve.js Outdated Show resolved Hide resolved
Co-authored-by: Antoine du Hamel <[email protected]>
@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 8, 2021
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

guybedford added a commit that referenced this pull request Sep 12, 2021
PR-URL: #40044
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
@guybedford
Copy link
Contributor Author

Landed in 5c1adda.

@guybedford guybedford closed this Sep 12, 2021
@guybedford guybedford deleted the pattern-dollar-replacements branch September 12, 2021 20:46
BethGriggs pushed a commit that referenced this pull request Sep 21, 2021
PR-URL: #40044
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
BethGriggs pushed a commit that referenced this pull request Sep 21, 2021
PR-URL: #40044
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
@BethGriggs BethGriggs mentioned this pull request Sep 21, 2021
1 task
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.

5 participants