-
Notifications
You must be signed in to change notification settings - Fork 170
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
Hooks Problem #252
Comments
Can you please clarify what you mean by "causes a lot of errors"? If you're using from a CDN, you may need to mark Preact as external in your import map so that these packages don't bring in their own versions of Preact.
Shouldn't be used, it was deprecated in Preact X/10 which came out years ago. Use |
What I mean to say is one of the plugin for example required version greater than another. Giving the example of Preact Signals V0.0.4 when importing it through CDN it uses preact@v10.12 which then cannot be lowered so the resolution I'll make is to update my preact version. but when I do it gives me an error with the hooks module. It's throwing an error on the first function component that uses a Hooks specifically on this line. now I'm thinking that these happen because the htm module could possibly not support higher versions? because these things happen only when I upgrade to greater than Preact 10.6 or 10.7.
how do I exaclty do that?
I will do that thank you for informing me. |
No, you're just importing multiple version of Preact which conflict with each other. Preact (and React) require to be loaded as singletons, else you'll see that
<script type="importmap">
{
"imports": {
"preact": "https://esm.sh/preact@10.12.1",
"preact/": "https://esm.sh/preact@10.12.1/",
"@preact/signals": "https://esm.sh/@preact/signals@1.1.3?external=preact",
"htm": "https://esm.sh/htm@3.1.1"
}
}
</script> You can change up the versions to whatever you need (within reason -- The general idea here is that most CDNs will load dependencies, so if you ask for Note: the |
I see. currently, no errors we're being displayed even though I have different versions(Lower versions) but I'll sure try out to sort my Preact versions first and see if I'm still getting the same error. I'm using skypack I'm checking on their documentation but it does not seem to have an
+1 we just have to live we it xd |
Yeah, unfortunately Skypack became unmaintained and I don't think it's seen any changes in a few years. |
After fixing the imports using |
Glad it's working! Feel free to ping me if you run into any issues. Sorry that this is a bit of a pain. |
First of all thank you for this wonderful plugin.
But unfortunately, the current plugin is not working well on Preact @v10.7+ I really wanted to upgrade my versions as 10.6.3 is a bit outdated and I'm missing few features that I need for the project I'm working on I am using multiple plugin for preact. Some of the versions requires higher Preact version which causes a lot of errors for me when trying to switch versions the only working version I tried is 10.6.3 that does not create conflicts with all these plugins.
Working Versions:
Preact: 10.6.3
Preact Hooks: 10.6.3
Preact Compat: 10.6.3
@preact Signal: 1.1.5
Preact-router: v3.2.1
Preact-async-route: 2.2.1
Versioned tried to and failed:
Preact: 10.7.3^
Preact Hooks: 10.7.3^
Preact Compat: 10.7.3^
@preact Signal: 1.1.5^
Preact-router: v3.2.1^
Preact-async-route: 2.2.1^
It would be really nice it this work on atleast Preact v10.16.
The text was updated successfully, but these errors were encountered: