Library seems to confuse skypack CDN
I was trying to use this library in observable snippet and run into issue, it seems that something is confusing skypack CDN resulting in broken library. Here is the link to an example https://observablehq.com/@protocol/ucan-skypack-problem
Some progress on this: It's somewhat hard to get a stacktrace in observable. Running this in the browser console reproduces the issue:
UCAN = await import("https://cdn.skypack.dev/ucans")
UCAN.publicKeyBytesToDid(new Uint8Array([1, 2, 3]), "rsa")
Skypack transforms an import of uint8arrays into
import require$$0 from "/-/[email protected]/dist=es2019,mode=imports/optimized/uint8arrays.js";
And they transform the source uint8arrays module (dist/esm/src/index.js) into this:
export {compare} from "./uint8arrays/compare.js";
export {concat} from "./uint8arrays/concat.js";
export {equals} from "./uint8arrays/equals.js";
export {fromString} from "./uint8arrays/from-string.js";
export {toString} from "./uint8arrays/to-string.js";
export {xor} from "./uint8arrays/xor.js";
import "./common/bases-af280048.js";
import "/-/[email protected]/dist=es2019,mode=imports/optimized/multiformats/basics.js";
export default null;
I have no idea why it's export default null. The source file exports some stuff.
Not sure what we can do about this. This seems like an issue with skypack. I've submitted an issue on their repository.
We could make it easier for skypack by also bundling ESM, but that's just my hypothesis at this point.
Yeah sadly we also had not so great experience with skypack things working on one version and stopping in the other. In our case it was one of the dependencies that had issues, but sadly I don’t know of a good way to identify the problems
From context, is this a #wontfix?
Maybe this could be re-framed to make it possible to load this lib on observable (and other ESM native runtimes) ?
I might also give this a go if I find some time to do so