-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into remove-qs
- Loading branch information
Showing
25 changed files
with
247 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Minimum React Version | ||
|
||
#### Why This Error Occurred | ||
|
||
Your project is using an old version of `react` or `react-dom` that does not | ||
meet the suggested minimum version requirement. | ||
|
||
Next.js suggests using, at a minimum, `[email protected]` and `[email protected]`. | ||
Older versions of `react` and `react-dom` do work with Next.js, however, they do | ||
not enable all of Next.js' features. | ||
|
||
For example, the following features are not enabled with old React versions: | ||
|
||
- [Fast Refresh](https://nextjs.org/docs/basic-features/fast-refresh): instantly | ||
view edits to your app without losing component state | ||
- Component stack trace in development: see the component tree that lead up to | ||
an error | ||
- Hydration mismatch warnings: trace down discrepancies in your React tree that | ||
cause performance problems | ||
|
||
This list is not exhaustive, but illustrative in the value of upgrading React! | ||
|
||
#### Possible Ways to Fix It | ||
|
||
**Via npm** | ||
|
||
```bash | ||
npm upgrade react@latest react-dom@latest | ||
``` | ||
|
||
**Via Yarn** | ||
|
||
```bash | ||
yarn add react@latest react-dom@latest | ||
``` | ||
|
||
**Manually** Open your `package.json` and upgrade `react` and `react-dom`: | ||
|
||
```json | ||
{ | ||
"dependencies": { | ||
"react": "^16.10.0", | ||
"react-dom": "^16.10.0" | ||
} | ||
} | ||
``` | ||
|
||
### Useful Links | ||
|
||
- [Fast Refresh blog post](https://nextjs.org/blog/next-9-4#fast-refresh) | ||
- [Fast Refresh docs](https://nextjs.org/docs/basic-features/fast-refresh) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
The ISC License | ||
|
||
Copyright (c) Isaac Z. Schlueter and Contributors | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR | ||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"semver","main":"index.js","license":"ISC"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// issuer.endsWith(path.posix.sep) || issuer.endsWith(path.win32.sep) | ||
import findUp from 'next/dist/compiled/find-up' | ||
import * as path from 'path' | ||
import { promises as fs } from 'fs' | ||
import JSON5 from 'next/dist/compiled/json5' | ||
import { resolveRequest } from './resolve-request' | ||
|
||
export async function getPackageVersion({ | ||
cwd, | ||
name, | ||
}: { | ||
cwd: string | ||
name: string | ||
}): Promise<string | null> { | ||
const configurationPath: string | undefined = await findUp('package.json', { | ||
cwd, | ||
}) | ||
if (!configurationPath) { | ||
return null | ||
} | ||
|
||
const content = await fs.readFile(configurationPath, 'utf-8') | ||
const packageJson: any = JSON5.parse(content) | ||
|
||
const { dependencies = {}, devDependencies = {} } = packageJson || {} | ||
if (!(dependencies[name] || devDependencies[name])) { | ||
return null | ||
} | ||
|
||
const cwd2 = | ||
cwd.endsWith(path.posix.sep) || cwd.endsWith(path.win32.sep) | ||
? cwd | ||
: `${cwd}/` | ||
|
||
try { | ||
const targetPath = resolveRequest(`${name}/package.json`, cwd2) | ||
const targetContent = await fs.readFile(targetPath, 'utf-8') | ||
return JSON5.parse(targetContent).version ?? null | ||
} catch { | ||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!node_modules |
1 change: 1 addition & 0 deletions
1
test/integration/cli/old-react-dom/node_modules/react-dom/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
test/integration/cli/old-react-dom/node_modules/react-dom/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"react": "*", | ||
"react-dom": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Home() { | ||
return <p>Hello</p> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!node_modules |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
test/integration/cli/old-react/node_modules/react/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"react": "*", | ||
"react-dom": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Home() { | ||
return <p>Hello</p> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2903,6 +2903,13 @@ | |
"@types/glob" "*" | ||
"@types/node" "*" | ||
|
||
"@types/[email protected]": | ||
version "7.3.1" | ||
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.1.tgz#7a9a5d595b6d873f338c867dcef64df289468cfa" | ||
integrity sha512-ooD/FJ8EuwlDKOI6D9HWxgIgJjMg2cuziXm/42npDC8y4NjxplBUn9loewZiBNCt44450lHAU0OSb51/UqXeag== | ||
dependencies: | ||
"@types/node" "*" | ||
|
||
"@types/[email protected]": | ||
version "0.14.4" | ||
resolved "https://registry.yarnpkg.com/@types/send/-/send-0.14.4.tgz#d70458b030305999db619a7b057f7105058bd0ff" | ||
|
@@ -14237,15 +14244,15 @@ [email protected]: | |
version "7.0.0" | ||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" | ||
|
||
[email protected], semver@^7.3.2: | ||
version "7.3.2" | ||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" | ||
|
||
semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: | ||
version "6.3.0" | ||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" | ||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== | ||
|
||
semver@^7.3.2: | ||
version "7.3.2" | ||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" | ||
|
||
semver@~5.3.0: | ||
version "5.3.0" | ||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" | ||
|