Skip to content

Comments

Fix merge existing and new import maps - reversed operands#12167

Open
yoavweiss wants to merge 1 commit intowhatwg:mainfrom
yoavweiss:fix-merge-import-maps-starts-with-order
Open

Fix merge existing and new import maps - reversed operands#12167
yoavweiss wants to merge 1 commit intowhatwg:mainfrom
yoavweiss:fix-merge-import-maps-starts-with-order

Conversation

@yoavweiss
Copy link
Contributor

@yoavweiss yoavweiss commented Feb 16, 2026

As #11875 points out, the operants in 'merge existing and new import maps' algorithm, step 6.1.1 are reversed. This changes them to be in the right order.

Fixes #11875

As this is a spec bug fix, the below checks are not relevant.

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
    • Deno (only for timers, structured clone, base64 utils, channel messaging, module resolution, web workers, and web storage): …
    • Node.js (only for timers, structured clone, base64 utils, channel messaging, and module resolution): …
  • Corresponding HTML AAM & ARIA in HTML issues & PRs:
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


/webappapis.html ( diff )

…maps

In the 'merge existing and new import maps' algorithm, step 6.1.1
checked if `specifier` (from newImportMapImports) starts with
`record`'s specifier (from the resolved module set). This is
backwards — the check should be whether the resolved module's
specifier starts with the new import map's specifier, to correctly
detect when a new import map rule could impact an already-resolved
module.

For example, if 'resources/log.js' has already been resolved and a
new import map adds a mapping for 'resources/', the algorithm should
detect that 'resources/log.js' starts with 'resources/' and remove
the new rule. The previous order checked if 'resources/' starts with
'resources/log.js', which is always false.

Fixes whatwg#11875
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect "starts with" order of newImportMapImports' specifier and resolved module set's specifier in merge existing and new import maps

1 participant