Skip to content
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

[using-inferno] Next.js 4 requires React 16 #3264

Closed
1 task done
lyquocnam opened this issue Nov 10, 2017 · 4 comments
Closed
1 task done

[using-inferno] Next.js 4 requires React 16 #3264

lyquocnam opened this issue Nov 10, 2017 · 4 comments

Comments

@lyquocnam
Copy link

lyquocnam commented Nov 10, 2017

can not swich react 16 to inferno, i try to clone https://github.com/zeit/next.js/tree/canary/examples/using-inferno but not work

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Next.js 4 requires React 16

Current Behavior

Steps to Reproduce (for bugs)

  1. next build
  2. next start
  3. Next.js 4 requires React 16

Context

Your Environment

Tech Version
next 4
node 9
OS osx
browser chrome
etc
@JeromeFitz
Copy link
Contributor

JeromeFitz commented Nov 10, 2017

Looks like there are two things at the moment:

  1. Inferno needs to be updated in the example project.
  • When installing locally: All versions before 3.x are deprecated!
  1. After doing that next has code in their server right now that is doing a specific check
// TODO: Remove this in Next.js 5
if (!(/^16\./.test(reactPkg.version))) {
  const message = `
Error: Next.js 4 requires React 16.
Install React 16 with:
  npm remove react react-dom
  npm install --save react@16 react-dom@16
`
  console.error(message)
  process.exit(1)
}
  • This would cause inferno, preact, etc. to not be able to use the next server.

Until this is resolved, I believe you could bypass the next server by using a custom server (examples in the examples directory) and updating your dependencies accordingly to test out.

In attempting to test this, I realize now that this example runs a custom server.js much like the custom server examples, and the issue with requiring [email protected] is still present.

@vladejs
Copy link

vladejs commented Nov 21, 2017

Is this already solved?

@acao
Copy link

acao commented Dec 8, 2017

I had issues with preact as well, before this message appeared. Next 4/5 uses ReactDom.hydrate() and some other react 16 features not available yet in preact-compat or inferno-compat

see: preactjs/preact-compat#432

@acao
Copy link

acao commented Dec 8, 2017

ReactDom.hydrate() will be tricky - ReactDom got quite the overhaul in React 16.

just dug through the call stack and it's deeply enmeshed with fiber and react-reconciler. not sure how to re-create this in preact or inferno without just being cheap and calling the compatibility layer's render() instead.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants