I think it’s less of a path issue but more module format issue. The JS space is a mess with several different module formats (AMD, UMD, CommonJS, ES modules) and annoyingly the standards compliant one (which is what we need for import maps since we are using the browser native function to import modules) is sort of the least well supported by the NPM world.
I believe jspm.io is attempting to make any npm package available in ES format (i.e. the standards-compliant format) but it doesn’t always work depending on the package. In fact, I think I remember getting into that same wormhole myself with underscore trying to use its debounce
method and in the end went with a separate “debounce” package because underscore was giving me so many problem.
Hopefully with time these kinks will get worked out as ES modules start to gain some dominance. But we have a lot of legacy code out there.
I believe the importmap script Rails provides can do either but by default it downloads to vendor/javascripts
and that is added as part of your repo (not git-ignored).
I’m not a fan of the “add to your repo” strategy also and prefer to install deps as part of the build process so followed the basic process here (with one minor bug correction I noted) with success.