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

Deno with esm.sh #72

Closed
4 tasks done
ralyodio opened this issue Nov 14, 2021 · 11 comments
Closed
4 tasks done

Deno with esm.sh #72

ralyodio opened this issue Nov 14, 2021 · 11 comments
Labels
🏗 area/tools This affects tooling 👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@ralyodio
Copy link

Initial checklist

Problem

error: Import 'https://cdn.esm.sh/v57/nlcst-to-string@2.0.4/es2021/nlcst-to-string.js' failed: 408 Request Timeout
at https://cdn.esm.sh/v57/parse-latin@5.0.0/es2021/parse-latin.js:2:27264

Deosn't seem to work with Deno yet.

Solution

support Deno

Alternatives

https://esm.sh

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Nov 14, 2021
@wooorm
Copy link
Member

wooorm commented Nov 14, 2021

That looks like an esm.sh bug? Maybe report it there?
The error message also says they’re working on it?

@ralyodio
Copy link
Author

Oh you know my internet was flaky. Let me try again

@chovyprognos
Copy link

Still not working. its not my internet.

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Nov 16, 2021

I tried opening an interactive deno shell, and entered:

import {retext} from 'https://cdn.skypack.dev/retext@8.1.0?dts'

retext.parse('an example sentence')

it worked fine, this issue is specific to esm.sh not retext.

@ChristianMurphy ChristianMurphy added the 👀 no/external This makes more sense somewhere else label Nov 16, 2021
@github-actions

This comment has been minimized.

@ChristianMurphy ChristianMurphy added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Nov 16, 2021
@github-actions

This comment has been minimized.

@ChristianMurphy
Copy link
Member

This was logged as esm-dev/esm.sh#215

@ChristianMurphy ChristianMurphy added the 🏗 area/tools This affects tooling label Nov 16, 2021
@ChristianMurphy ChristianMurphy changed the title Deno support? Deno with esm.sh Nov 16, 2021
@ralyodio
Copy link
Author

How do I load retextPos and retextKeywords from skypack?

@wooorm
Copy link
Member

wooorm commented Nov 16, 2021

That sounds like a question either for skypack, or for deno folks.

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Nov 16, 2021

@ralyodio skypack works largely the same as esm.sh, it uses the url structure https://cdn.skypack.dev/ add the npm package name @ npm version ?dts.

So it would look like:

import retextKeywords from 'https://cdn.skypack.dev/retext-keywords@7.1.0?dts'
import retextPos from 'https://cdn.skypack.dev/retext-pos@4.1.0?dts'

checking with an interactive deno session, it looks like a nested package under retext-pos is having an issue with skypack.

[Package Error] "pos@v0.4.2" could not be built. 
Uncaught Error: [Package Error] "pos@v0.4.2" could not be built. 
    at https://cdn.skypack.dev/error/build:pos@v0.4.2-CpR50sqbM07FaeuJMu2I:13:7

It may be worth floating that to the skypack folks to get a better understand of what the Internal server error is, and whether it can be fixed on skypack.
FWIW, esm.sh also seems to be failing on retext-pos, likely on pos, but it gives a vague timeout error.

It may be worth checking some other CDNs, including: https://unpkg.com/, https://www.jsdelivr.com/esm, https://jspm.org/, etc

Another option would not using a CDN, and using a unbundled build tool like snowpack https://www.snowpack.dev/concepts/how-snowpack-works to generate an ESM friendly web_modules folder (snowpack is a wrapper around https://www.npmjs.com/package/esinstall).

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Nov 16, 2021

Another note worth adding, typescript in deno has it's limitations currently, specifically handling ambient types, like those from definitely typed.
Skypack is aware skypackjs/skypack-cdn#116, and they (and likely other CDNs) appear to be waiting for the outcome of microsoft/TypeScript#28985 (and maybe microsoft/TypeScript#35749) to decide how to handle this situation.
In the meantime, deno run --no-check {file-name} is an option if an npm package which depends on things like @types/unist or @types/nlcst, which retext, unified, and vfile do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏗 area/tools This affects tooling 👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

4 participants