Open jcoyne opened 10 months ago
I also had trouble understanding how Importmap works since version 2.
What I've found is that you have to specify the specific version with the '@' sign like this:
bin/importmap pin jsprintmanager@5.0.2
This will result in the following in importmap.rb
:
pin "jsprintmanager" # @5.0.2
The version number will be appended in a comment.
It will also download the file to vendor/javascript
, which is something we previously needed to explicitly add the --download
option for when pinning. Now, it always downloads the file, I believe.
You can see that the parameter to: 'https://....'
is no longer used in the importmap.rb
file. The 'old' syntax is actually confusing because the version specified in the URL will not match the actual downloaded version.
For unpinning, there's no need to specify the version:
bin/importmap unpin jsprintmanager@5.0.2
bin/importmap unpin jsprintmanager@6.0.0
bin/importmap unpin jsprintmanager
All of these commands will unpin the library even if the version mismatch. The only requirement is that the version actually exists on JSPM is you chose to specify a version.
Also, be careful because bin/importmap update
will update all libraries to the latest version. If you need to keep an old version of a specific library, I think you can use:
importmap outdated
and then pin each library that needs to be updated one by one.
On 2.0.1
I first list the packages I've pinned:
Then I try to unpin video.js:
If I try it without the version I see:
However I was able to unpin other packages: