Styled-components-website: Upgrade to Next@4 with React@16

Created on 9 Oct 2017  路  7Comments  路  Source: styled-components/styled-components-website

enhancement good first issue

Most helpful comment

@mxstbr I would like to work on this one.

All 7 comments

@mxstbr I would like to work on this one.

Do it!

Oh, I was going to work on this 'good first issue'.
But anyway, I've done some initial investigation today.
Since Next.js 4 requires React 16:

  • You will not be able to use preact-compat in production mode any more.
  • You will need to upgrade Enzyme to v3 and update snapshots for the tests to pass.

@vtserman What changes are to be made for the preact-compat issue?
Saw your comment after making the PR. Though upgraded Enzyme and updated snapshots.

Current version uses Preact for the production where it gives better performance, but since you upgraded to Next@4 with React@16 you will get an error "Error: Next.js 4 requires React 16." when trying to start application in production mode (npm build & npm start).
Use next.config.js to customize webpack config to turn off support of preact-compat.

Here is the code fragment from Next.js that blocks application startup.

import reactPkg from 'react/package'

// 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)
}

@ishankbahl let's wait until Next provides support for preact again. We wouldn't gain anything from upgrading to React 16 right now, and Streamed SSR is not interesting for us anyway, as all SSR routes are cached.

Upgraded to Next@7 and React@16

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mxstbr picture mxstbr  路  3Comments

el1f picture el1f  路  4Comments

mxstbr picture mxstbr  路  4Comments

kitten picture kitten  路  6Comments

niraj8 picture niraj8  路  5Comments