Closed dmail closed 4 years ago
Now I have written all that it seems only an import like
import "/node_modules/whatever/file.js"
Inside a node module source file itself would be remapped by the importMap above.
Despites "/node_modules/whatever/file.js"
import specifier being strange to have in a node module source, the resulting remapping would make sense without breaking the node module folder scoping.
Feel free to close without any comment, I got my answer.
I don't close issue myself immediatly in case this use case or my reflexion might be valuable or wrong.
Hello,
I would like to use importMap to be able to scope import to a given folder. That folder is in fact the node_modules folder containing the files.
To achieve this I would create the following importMap:
For the record I need both
"/node_modules/whatever/"
and"/"
remapping to ensure import will be either:Until here, it would work perfectly.
But, if I understand the specs right, imports matching depends on the specifier length. It makes me fear that most remapping would loose to
"/node_modules/whatever/": "/node_modules/whatever/"
.For instance, adding a remapping like
"foo": "bar"
in the importMap results into:But with the reference implementation importMap would be sorted and
"foo": "bar"
could not work as expected ?