-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-plugin-preact] Uncaught TypeError: Object(...) is not a function #8545
Comments
@rwieruch Thanks for providing us with the reproduction repo. I can confirm that Gatsby uses |
@kakadiadarpan thanks for your response and providing a solution. Would you say this is the solution to go for or will the gatsby-preact-plugin get an update eventually and this is only a workaround? |
@rwieruch I'm afraid it's not a solution. If you uncomment the line number 10 then you'll see the build failing |
Partially fixed with preactjs/preact#1138 and preactjs/preact#963. Also requires aliasing However, due to type changes it introduced a bug that requires fixing: After all of those fixes I was able to get local version working, hopefully everything lands in preact 8.4. It would be helpful to document that Preact support for React 16 and Reach/Router (Gatsby 2) is broken until new updates land. |
@ArthurYidi Would you be interested in adding warning to |
For me i use reach router and inferno and i have no issue |
Updating the codesandbox @kakadiadarpan to preact 8.4.2 and preact-compat 3.18.4 makes the @reach/router issues go away - (here's a forked sandbox) Updating the version, however, does not solve the issue. Here's a fork of the minimal reproduction repo with an updated preact version. Still gets the backtrace
@ArthurYidi @kakadiadarpan any thoughts on why this would be? Planning to do a little more digging, but it seems like the incompatibility demonstrated by the codesandbox is no longer the basic problem. There must be something else! |
Looks like the other issues are dependencies on react's context api (still mostly from @reach/router, since that uses a ton of the new react 16 features). preactjs/preact#963 is the preact core issue tracking adding support, and As mentioned in this comment there's still a big hack you have to do to make preact-compat export a viable In this commit I tried to do the set of updates needed to load a working version of the plugin, but things are still broken with those, in the following ways:
🤔 🤔 🤔
Digging into the source around that point, it looks like something with the renderer:
I have not uncovered what this means or what's wrong, but maybe this is what @ArthurYidi meant by
Adding documentation of how this is broken to the plugin seems like a good idea. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
Description
I wanted to use gatsby-plugin-preact but I ran into an issue. So I created a minimal issue where it happens too.
Steps to reproduce
Take the gatsby-starter-blog (or I guess any other project), do the setup, and install gatsby-plugin-react. Here is a minimal application for this problem.
Expected result
The application should work.
Actual result
I get the following stack trace:
The text was updated successfully, but these errors were encountered: