-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importmap pin --download does not work for multi-files dependencies #153
Comments
Same problem here. ¿Some workaround? |
I came across this problem for another package. Try putting the minified version (e.g. https://ga.jspm.io/npm:[email protected]/dist/chart.min.js) into your vendor file instead @chuchiperriman. Related issue at #65 |
My workaround is to manually download the files in a vendor directory. Here is my script #!/bin/bash
cd $(dirname "$0")
main(){
jspm chart.js 3.9.1
dl chart.js/dist/chart.mjs
dl chart.js/_/16cda191.js
dl chart.js/dist/chunks/helpers.segment.mjs
}
jspm(){
local pkg="$1"
local ver="$2"
local kind=npm
packages[$pkg]=https://ga.jspm.io/$kind:$pkg@$ver/
}
dl(){
local path="$1"
local pkg="${path%%/*}"
local pkgpath="${path#*/}"
local dir="${path%/*}"
local urlprefix="${packages[$pkg]}"
mkdir -p "javascript/$dir"
path=${path//.mjs/.js} # because rails-importmap cannot pin .mjs files
>&2 echo "dl $pkg/${path#*/} $urlprefix$pkgpath"
curl -s -o "javascript/$path" "$urlprefix$pkgpath"
}
declare -A packages
main "$@"
Then in pin_all_from 'vendor/javascript'
pin 'chart.js', to: 'chart.js/dist/chart.js' |
Would be happy to see a patch where the dependencies are downloaded as well. |
There's a workaround based on JSDelivr here |
I need to have
chart.js
in my application, if I pin it without the download option, it works fine:It will load the following URLs at runtime:
However, if I run:
It does not work because dependent files are not downloaded. I get the following exception in rails:
However, I'd still like to serve the dependency locally
The text was updated successfully, but these errors were encountered: