WICG / import-maps

How to control the behavior of JavaScript imports
https://html.spec.whatwg.org/multipage/webappapis.html#import-maps
Other
2.65k stars 69 forks source link

Consider supporting trailing slash exact mappings #257

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

There is an old Node.js pattern whereby a require('pkg/') import style is permitted to resolve.

if trying to support such a map in import maps via:

{
  "imports": {
    "pkg/": "/path/to/pkg/index.js"
  }
}

the browser console gives the error:

Ignored an import map value of "a/": Since specifierKey ended in a slash, so must the address: /a.js

If such a pattern were to remain used in Node.js ES modules, it might make sense to still consider supporting these cases resolving. //cc @hiroshige-g

domenic commented 2 years ago

Dupe of https://github.com/WICG/import-maps/issues/244 ?

guybedford commented 2 years ago

Ah thanks, yes closing. Wdyt re progress there? I'm tempted to consider proposing Node.js ban all trailing slash resolutions otherwise for ESM.

domenic commented 2 years ago

Yeah, I don't think we have any new information that would change the calculus over there...