Next.js: with-preact example doesn't work with next 8.0.0

Created on 12 Feb 2019  ·  9Comments  ·  Source: vercel/next.js

Bug report

Describe the bug

with-preact example throws the following error:

exports.HeadManagerContext = React.createContext(null);
                                   ^

TypeError: React.createContext is not a function
    at Object.<anonymous> (/home/user/next-preact/using-preact-app/node_modules/next-server/dist/lib/head-manager-context.js:11:36)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/user/next-preact/using-preact-app/node_modules/next-server/dist/lib/head.js:8:32)
    at Module._compile (module.js:653:30)

To Reproduce

npx create-next-app --example using-preact using-preact-app && cd using-preact-app && npm run build && npm run start

Expected behavior

createContext should be polyfilled perhaps like in this example.

good first issue

Most helpful comment

@Timer @timneutkens @toshi1127 The new version of @zeit/next-preact doesn't seem to have been published on NPM (canary version is still 0.1.1-canary.0)

All 9 comments

@timneutkens
@willross
I am worried about PR to OSS for the first time, but I hope it makes sense!
https://github.com/zeit/next-plugins/pull/400

@toshi1127 looks like a great PR! Just had one comment 🙏

PR merged.

6764 error still here

Yes, error still

@Timer @timneutkens @toshi1127 The new version of @zeit/next-preact doesn't seem to have been published on NPM (canary version is still 0.1.1-canary.0)

This bug goes deeper than that. The real issue is that Next is no longer compatible with Preact because it uses Suspense, which, as of now, is not implemented in Preact -> https://github.com/zeit/next.js/issues/7231

@LukasBombach It seems that Preact will support Suspense and lazy in the upcoming version, so it should be 100% compatible again ✨

https://github.com/preactjs/preact/releases/tag/10.0.0-beta.2

Yeah! So awesome! Kudos to everyone involved!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenji4569 picture kenji4569  ·  3Comments

ghost picture ghost  ·  3Comments

jesselee34 picture jesselee34  ·  3Comments

renatorib picture renatorib  ·  3Comments

timneutkens picture timneutkens  ·  3Comments