importmap-rails icon indicating copy to clipboard operation
importmap-rails copied to clipboard

Should sources be tracked?

Open dchacke opened this issue 1 year ago • 0 comments

Importmap doesn’t seem to track any sources so running update can trigger a download from a different source than the one from which a package was originally installed.

$ bin/importmap pin [email protected] --from unpkg
Pinning "imask" to vendor/javascript/imask.js via download from https://unpkg.com/[email protected]/esm/index.js

$ bin/importmap update 
Pinning "imask" to vendor/javascript/imask.js via download from https://ga.jspm.io/npm:[email protected]/esm/index.js

There’s no guarantee that different sources serve the same files. For example, https://ga.jspm.io/npm:[email protected]/esm/index.js is different from https://unpkg.com/[email protected]/esm/index.js

I suggest keeping track of the source for each dependency and reusing it when updating. SO user Alex suggests an implementation here (under update 2).

dchacke avatar Aug 14 '24 22:08 dchacke