preact icon indicating copy to clipboard operation
preact copied to clipboard

[preact/compat] [Next.js] Uncaught TypeError: (0 , l.use) is not a function

Open EliasVal opened this issue 1 year ago • 3 comments

  • [ ] Check if updating to the latest Preact version resolves the issue

Describe the bug Next.js version: 14.3.0-canary.49 (latest canary at the time of writing) Preact version: latest

next dev works fine, next build builds successfully but the following error is logged when entering the website:

Uncaught TypeError: (0 , l.use) is not a function
    at O.w [as constructor] (app-index.tsx:131:10)
    at O.B [as render] (preact.module.js:1:9068)
    at I (preact.module.js:1:6486)
    at T (preact.module.js:1:1877)
    at I (preact.module.js:1:6700)
    at T (preact.module.js:1:1877)
    at I (preact.module.js:1:6700)
    at T (preact.module.js:1:1877)
    at I (preact.module.js:1:6700)
    at T (preact.module.js:1:1877)

To Reproduce

  1. Build your Next.js app
  2. Open the website

Expected behavior Website to open normally

EliasVal avatar May 08 '24 12:05 EliasVal

NextJS is not supported with Preact, FYI.

We don't provide an implementation for use yet through compat, which looks like the issue.

Build your Next.js app

This is not a valid reproduction. Please follow the instructions we laid out in the bug template, it's there so we can help you better.

rschristian avatar May 08 '24 14:05 rschristian

Hey! Sorry for the (very) late response.

This is not a valid reproduction. Please follow the instructions we laid out in the bug template, it's there so we can help you better.

Unfortunately, that's all that happens by the time that the error occurs. I build the application, run it, go to the website and I see a blank page with that error logged in the console.

We don't provide an implementation for use yet through compat, which looks like the issue.

That seems to be the issue, the use hook is new so should've expected that not all libraries support it yet 😅

NextJS is not supported with Preact, FYI.

Are there plans for official Next.js support?

EliasVal avatar May 27 '24 11:05 EliasVal

I build the application, run it, go to the website and I see a blank page with that error logged in the console.

"Build a NextJS app" is not a valid reproduction. As the issue template instructs, we need a repo we can clone or a Stackblitz/CodeSandbox to look at.

Are there plans for official Next.js support?

NextJS will not be supported, no.

They killed any chance of continued support (not that we necessarily loved maintaining the plugin either, it often broke) and entirely bought into React.

rschristian avatar May 27 '24 11:05 rschristian

I am not sure whether there's currently a good use case for supporting use, it's a React canary thing and the use case for it feels more server-component-y than anything else. As we haven't fully formulated how we'll address this in the future I prefer closing this as React 19 is still in beta and Next is just ahead of the curve. Next has also been pretty adamant in not supporting us

JoviDeCroock avatar Nov 17 '24 16:11 JoviDeCroock