developit / nextjs-preact-demo

Next.js 9.3 + Preact = 21kB
https://nextjs-preact.now.sh
384 stars 25 forks source link

Broken with next@9.5.3 and preact@10.4.8 #19

Closed berndartmueller closed 3 years ago

berndartmueller commented 4 years ago

Hello,

first of all, I'm a huge fan of being able to use Preact together with Next.js. It's an awesome combination!

Unfortunately, I can not get it to work with next@9.5.3 (using TypeScript) and preact@10.4.8. Build successfully finishes, but when I start the app, nothing gets rendered.

To be correct, following gets rendered:

<html><head></head><body><undefined></undefined></body></html>

Are there any known issues?

Thanks!

UPDATE:

I got it to work using https://github.com/vercel/next.js/tree/canary/examples/using-preact

The only thing I now notice is that bundle size increase from 21.1 kB to 26.2 kB. I suspect this increase to caused by a different next.config.js than in your example.

developit commented 4 years ago

Hmm - are you able to show your next.config.js? Typically <undefined> is caused by React.createElement being used with preact, which is not supported.

marvinhagemeister commented 3 years ago

Just checked with the current master and it builds fine with TypeScript. The page is rendered via SSR correctly in production mode for me 👍