Commit 0c8dca6f authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by Guillermo Rauch

Warn and exit if React 15 used inside the project. (#3061)

This usually helps when upgrading Next.js.
parent 8ab50ecb
...@@ -16,6 +16,19 @@ import { getAvailableChunks } from './utils' ...@@ -16,6 +16,19 @@ import { getAvailableChunks } from './utils'
import getConfig from './config' import getConfig from './config'
// We need to go up one more level since we are in the `dist` directory // We need to go up one more level since we are in the `dist` directory
import pkg from '../../package' import pkg from '../../package'
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)
}
const internalPrefixes = [ const internalPrefixes = [
/^\/_next\//, /^\/_next\//,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment