Description
In my project (using Rails 7 with importmap-rails) I am trying to import a module which has a complex dependency graph. In particular, two dependencies (let's call them A
and B
) depend on a third one (C
) although they require different versions of it, and so I end up in dependency hell.
This isn't a problem according to the WICG importmap spec, because you could use scopes to include both versions depending on which scope C
is being imported from, like so:
"scopes": {
"https://ga.jspm.io/npm:path-to-A/": {
"C": "https://ga.jspm.io/npm:[email protected]/index.js"
},
"https://ga.jspm.io/npm:path-to-B/": {
"C": "https://ga.jspm.io/npm:[email protected]/index.js"
}
}
In its current state, importmap-rails
doesn't make use of the scopes
object and only ever parses the imports
part of a generated importmap, in fact it ignores any scoped imports. A one-to-one map of names to paths is generated, and as a result, a singular module name can only ever point to a particular version of it. This potentially renders a complex importmap unusable. Is this something we could potentially have support for?