-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Multiple versions of the same library are loaded #420
Comments
since |
@ije that's indeed a bit icky regarding the If it would pick the latest version, than it would've worked fine. The weird thing is that it didn't pick the latest, but instead went with |
This is still an issue. Here's another example that's occurring: import "https://esm.sh/[email protected]";
import "https://esm.sh/[email protected]?alias=react:preact/compat&[email protected]"; This causes the browser to make the following preact requests: |
@Smiley43210 thanks for the details, I will look into it |
This still happens with latest esm.sh. I'm developing a project on Fresh and facing issues with multiple preact instances being loaded:
this is my deno.json: {
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"preact-render-to-string": "https://esm.sh/*[email protected]",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"twind": "https://esm.sh/[email protected]",
"twind/": "https://esm.sh/[email protected]/",
"$std/": "https://deno.land/[email protected]/",
"@radix-ui/react-dropdown-menu": "https://esm.sh/@radix-ui/[email protected]?alias=react:preact/compat&[email protected]",
"framer-motion": "https://esm.sh/[email protected]?alias=react:preact/compat&[email protected]"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
} When running the project I get this:
|
Failing module
Originally reported here: preactjs/preact#3725
We noticed an issue with esm.sh where it imports different versions of the same package with the default resolution behaviour. In our case both Preact
10.10.6
and10.11.0
are imported. Because the hooks functionality relies on a singleton global by design, they break when multiple versions of Preact are loaded. The older10.10.6
version is loaded by both https://esm.sh/preact-render-to-string and https://esm.sh/htm/preact .Reproduction case:
Error message
After
onload
I got this:This error always occurs when hooks are used and different versions of Preact are loaded.
Additional info
Workaround is to override the default versions picked by esm.sh to use the latest version of Preact:
The text was updated successfully, but these errors were encountered: