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

v136 external flag broken #1033

Open
adamgreg opened this issue Jan 15, 2025 · 6 comments · Fixed by #1036
Open

v136 external flag broken #1033

adamgreg opened this issue Jan 15, 2025 · 6 comments · Fixed by #1036
Assignees

Comments

@adamgreg
Copy link

Today esm.sh seems to have stopped propagating the external flag to transitive dependencies. At least, for type declarations. I guess this is related to the rollout of v136.

Some example output from deno info:

$ deno info "https://esm.sh/@radix-ui/[email protected]?external=react,react-dom,@types/react"

...

https://esm.sh/@radix-ui/[email protected]?external=react,react-dom,@types/react (707B)
├─┬ https://esm.sh/@radix-ui/[email protected]/X-ZUB0eXBlcy9yZWFjdCxyZWFjdCxyZWFjdC1kb20/dist/index.d.mts (2.33KB)
│ ├── npm:/[email protected]/compat (1.36MB)
│ └─┬ https://esm.sh/@radix-ui/[email protected]/dist/index.d.mts (2.7KB)
│   └─┬ https://esm.sh/@types/[email protected]/index.d.ts (167.2KB)
│     ├── https://esm.sh/@types/[email protected]/global.d.ts (7.2KB)

It looks like the URL for @radix-ui/react-primitive does not propagate the flags, and so it ends up importing @types/react from esm.sh, when it should be external.

I have a Deno Fresh project, and use esm.sh to alias React for Preact, so this is a major problem. For now should I add /v135/ to the URLs in my import map?

@ije
Copy link
Member

ije commented Jan 15, 2025

thanks, i will look into it.

@rschristian
Copy link

The Preact team is seeing some similar issues from users using esm.sh, seemingly from ?external not quite working in the same fashion as it did.

For example, preact/hooks depends on preact, and in the past, using https://esm.sh/preact/hooks?external=* would result in a module with a bare preact specifier. As of a day or so ago, it instead results in a module with this specifier: /[email protected]/es2022/preact.mjs.


Thanks for all the work you do to maintain this! The ecosystem as a whole really appreciates your time & effort.

@adamgreg
Copy link
Author

Hi @ije , thanks for looking into it, but I don't think your update fixed my original issue (which does not involve ?external=*).

If I clear my cache and run the deno info command from the issue's description again, I get the same output, which includes https://esm.sh/@types/react even though it is marked as external in the original URL.

Please could this be re-opened?

@ije ije reopened this Jan 17, 2025
@ije
Copy link
Member

ije commented Jan 17, 2025

yeah PR #1036 did fix this issue accutally, i will open another PR for this ASAP

@adamgreg
Copy link
Author

Thank you!

@lishaduck
Copy link

@ije, this still seems to be happening. Is there a workaround? What's needed to get it fixed?

@ije ije self-assigned this Feb 26, 2025
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

Successfully merging a pull request may close this issue.

4 participants