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

Incorrect x-typescript-types header when main entry is fetched directly #578

Closed
marvinhagemeister opened this issue Apr 4, 2023 · 6 comments · Fixed by #579
Closed

Incorrect x-typescript-types header when main entry is fetched directly #578

marvinhagemeister opened this issue Apr 4, 2023 · 6 comments · Fixed by #579
Labels
deno Not working in Deno

Comments

@marvinhagemeister
Copy link
Contributor

marvinhagemeister commented Apr 4, 2023

Failing module

import * as katex from "https://esm.sh/[email protected]/dist/katex.mjs"

Error message

Not an error per se, but deno is unable to find the correct typings. See discussion at denoland/deno#18583

The problem is that deno resolves the main package entry itself and fetches https://esm.sh/[email protected]/dist/katex.mjs directly instead of https://esm.sh/[email protected]. The latter has the correct x-typescript-types header, but the former points to an invalid one. Given that the former is an exact match of a main entry point I was expecting the main entry point to be resolved against @types/katex.

URL x-typescript-types Status
https://esm.sh/[email protected]/dist/katex.mjs https://esm.sh/v113/@types/katex@~0.16/dist/katex.mjs~.d.ts wrong
https://esm.sh/[email protected] https://esm.sh/v113/@types/katex@~0.16/index.d.ts correct

katax package.json:

{
  "name": "katex",
  "version": "0.16.4",
  "main": "dist/katex.js",
  "exports": {
    ".": {
      "require": "./dist/katex.js",
      "import": "./dist/katex.mjs" // <-- This file is fetched directly by deno
    },
    // ...
  }
}

@types/katax package.json:

{
    "name": "@types/katex",
    "version": "0.16.0",
    "main": "",
    "types": "index.d.ts",
    //...
}

Additional info

@marvinhagemeister marvinhagemeister added the deno Not working in Deno label Apr 4, 2023
@ije
Copy link
Member

ije commented Apr 4, 2023

i believe this has been fixed in c70aa0f, will release v114 very soon

@marvinhagemeister
Copy link
Contributor Author

marvinhagemeister commented Apr 4, 2023

Looks like it's not fully resolved. Just checked esm.sh out locally and I can reproduce the issue in main too (commit: c65507a).

@iuioiua
Copy link

iuioiua commented Apr 5, 2023

Likely related: #572

@ije ije closed this as completed in #579 Apr 5, 2023
@ije
Copy link
Member

ije commented Apr 5, 2023

thanks for fixing this!

@marvinhagemeister
Copy link
Contributor Author

marvinhagemeister commented Apr 5, 2023

@ije Awesome, thanks for the merge! Happy to help out!

@iuioiua Seems like that's a separate issue. I'll see if I can look into that.

@iuioiua
Copy link

iuioiua commented Apr 5, 2023

That'd be amazing, @marvinhagemeister!

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

Successfully merging a pull request may close this issue.

3 participants