-
Notifications
You must be signed in to change notification settings - Fork 120
Description
Hello,
I was trying to use importmap-rails to vendor highlight.js
As a non-javascript developer I'm struggling into understanding whether this is an issue with importmap-rails (probably it isn't) or in highlight.js, which is not importmap friendly when it comes to vendoring javascript files (can't use the cdn)
I only need to highlight json files for testing purposes, so I wanted to pin highlight.js/lib/core and highlight.js/lib/languages/json
The following happens when trying to pin core:
$ bin/importmap pin highlight.js/lib/core
Pinning "highlight.js/lib/core" to vendor/javascript/highlight.js/lib/core.js via download from https://ga.jspm.io/npm:highlight.js@11.10.0/es/core.js
$ cat vendor/javascript/highlight.js--lib--core.js
// highlight.js/lib/core@11.10.0 downloaded from https://ga.jspm.io/npm:highlight.js@11.10.0/es/core.js
import o from"../lib/core.js";export{o as HighlightJS,o as default};
As you can see there is a relative import to ../lib/core.js, and that results in a 404 error in the browser console.
Pinning highlight.js/lib/languages/json works instead, because the code is actually there
By inspecting the package source at https://www.npmjs.com/package/highlight.js?activeTab=code, I can see that package.json has some exports related to core:
"./lib/core": {
"require": "./lib/core.js",
"import": "./es/core.js"
},
Should I report this to highlight.js?
Thanks for any help you can provide