You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The biggest hassle I have so far with managing import maps by hand is that, depending on the install method, modules can be nested, or not.
The issue:
Sometimes I bootstrap a bunch of packages with Lerna. This results in:
my-app/
node_modules/
A/
node_modules/
B/
because B is a dependency of A, and A is symlinked into my-app by Lerna (where my-app is one of multiple projects managed by Lerna in, for example, a monorepo).
If I have the first importmap in my project, and then perform an flat install, it breaks. If I have the second importmap in my project and perform a linked install, it breaks.
Is there a solution to this?
Maybe I'm missing something, but do scopes solve this? If so, I haven't had any luck yet, and from the text, it seems like the provide an absolute final mapping, not that failed fetches would fall back.
What I'm imagining here is that a mechanism would try the scoped value, it gets a failure, then falls back like scope does. If this is already the case, I can't get it to work.
I've tried the following, hoping that it would fall back on a failure, so that it works with either install method without needing to update the importmap every time I change install method:
A workaround is to make all the transitive dependencies be direct dependencies of my-app in its package.json, so that Lerna will place them at the top level of node_modules besides in the linked modules, then the install format won't matter.
I suppose this workaround does make dependencies more "wholesomely" in my control as the app author.
The biggest hassle I have so far with managing import maps by hand is that, depending on the install method, modules can be nested, or not.
The issue:
Sometimes I bootstrap a bunch of packages with Lerna. This results in:
because B is a dependency of A, and A is symlinked into my-app by Lerna (where my-app is one of multiple projects managed by Lerna in, for example, a monorepo).
This leads me to write an importmap like so:
Other times, if I run
npm install
directly inside of my-app then I get flat modules:This leads me to write an importmap like so:
If I have the first importmap in my project, and then perform an flat install, it breaks. If I have the second importmap in my project and perform a linked install, it breaks.
Is there a solution to this?
Maybe I'm missing something, but do scopes solve this? If so, I haven't had any luck yet, and from the text, it seems like the provide an absolute final mapping, not that failed fetches would fall back.
What I'm imagining here is that a mechanism would try the scoped value, it gets a failure, then falls back like scope does. If this is already the case, I can't get it to work.
I've tried the following, hoping that it would fall back on a failure, so that it works with either install method without needing to update the
importmap
every time I change install method:The text was updated successfully, but these errors were encountered: