Skip to content
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

Library seems to confuse skypack CDN #14

Open
Gozala opened this issue Nov 15, 2021 · 6 comments
Open

Library seems to confuse skypack CDN #14

Gozala opened this issue Nov 15, 2021 · 6 comments

Comments

@Gozala
Copy link

Gozala commented Nov 15, 2021

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

@matheus23
Copy link
Member

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")

@matheus23
Copy link
Member

matheus23 commented Nov 16, 2021

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.

@matheus23
Copy link
Member

We could make it easier for skypack by also bundling ESM, but that's just my hypothesis at this point.

@Gozala
Copy link
Author

Gozala commented Nov 19, 2021

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

@expede
Copy link
Member

expede commented Nov 30, 2021

From context, is this a #wontfix?

@Gozala
Copy link
Author

Gozala commented Nov 30, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants