Closed sashafirsov closed 4 years ago
This is already possible with the existing spec. See the second example in the readme: https://github.com/WICG/import-maps#packages-via-trailing-slashes
@domenic , are you referencing to "Packages" via trailing slashes?
With the slash as denomination it definitely works, a bit odd to fuse into same imports
parameter two different concepts( Extension-less and hashes vs and package resolution), especially accounting that in other cases the separate parameter is used( scopes ).
The imports with slashes package resolution it is not clear the priority of longer path vs shorter resolution. I guess it worth to be explicitly stated. If the interface would accept the array instead of hash map, the priority would be defined by the order, i.e. explicit.
While
imports:{}
is giving 1:1 mapping for particular script, it is way more efficient to define the mapping on top level packages than individually on each JS or for that matter any another resource like CSS.Proposal.
Add
importRoots
array to mapping configThe array would support the prioritized list so overriding would be possible for same prefix: would be used only the first match occurrence.
With sample mapping above the code
would be translated into
The mapping of roots are well addressed by multiple build chains and their plugins: webPack, rollUp, RequireJS.
Proposal does not conflict with original
imports
as meant to be a complimentary.