diff --git a/.github/ISSUE_TEMPLATE/1.bug_report.yml b/.github/ISSUE_TEMPLATE/1.bug_report.yml
index 7bc9dedbb4fd0..d6b3957f5a83b 100644
--- a/.github/ISSUE_TEMPLATE/1.bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/1.bug_report.yml
@@ -12,10 +12,10 @@ inputs:
value: If you leave out sections there is a high likelihood it will be moved to the GitHub Discussions "Help" section.
- type: description
attributes:
- value: "Please first verify if your issue exists in the Next.js canary release line: `npm install next@canary`."
+ value: 'Please first verify if your issue exists in the Next.js canary release line: `npm install next@canary`.'
- type: description
attributes:
- value: "next@canary is the beta version of Next.js. It includes all features and fixes that are pending to land on the stable release line."
+ value: 'next@canary is the beta version of Next.js. It includes all features and fixes that are pending to land on the stable release line.'
- type: input
attributes:
label: What version of Next.js are you using?
diff --git a/lerna.json b/lerna.json
index 818d7d278c108..603fcfe52efe7 100644
--- a/lerna.json
+++ b/lerna.json
@@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
- "version": "10.0.6-canary.2"
+ "version": "10.0.6-canary.3"
}
diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json
index 861fc2b879e59..d0e3aa2d4f4b7 100644
--- a/packages/create-next-app/package.json
+++ b/packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"keywords": [
"react",
"next",
diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json
index 1c8f9520160bf..56efae1f0d3c0 100644
--- a/packages/eslint-plugin-next/package.json
+++ b/packages/eslint-plugin-next/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json
index a9c4558332ced..c9a6aed0f244b 100644
--- a/packages/next-bundle-analyzer/package.json
+++ b/packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"main": "index.js",
"license": "MIT",
"repository": {
diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json
index fe90490b4f14e..29a0b4129ef84 100644
--- a/packages/next-codemod/package.json
+++ b/packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
diff --git a/packages/next-env/package.json b/packages/next-env/package.json
index 6de9b0a4e6553..8407cf9c6d2f7 100644
--- a/packages/next-env/package.json
+++ b/packages/next-env/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/env",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"keywords": [
"react",
"next",
diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json
index 67a58c73ec5cb..d1685cc7b3535 100644
--- a/packages/next-mdx/package.json
+++ b/packages/next-mdx/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"main": "index.js",
"license": "MIT",
"repository": {
diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json
index 1eebe1dd31729..48ef3c642c229 100644
--- a/packages/next-plugin-google-analytics/package.json
+++ b/packages/next-plugin-google-analytics/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-google-analytics"
diff --git a/packages/next-plugin-sentry/package.json b/packages/next-plugin-sentry/package.json
index 3efe331aeeeb6..9295767a99d14 100644
--- a/packages/next-plugin-sentry/package.json
+++ b/packages/next-plugin-sentry/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json
index 7e4bf66945dc3..f115539639f35 100644
--- a/packages/next-plugin-storybook/package.json
+++ b/packages/next-plugin-storybook/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json
index f9815e56fb0f0..77ee00b7aa58f 100644
--- a/packages/next-polyfill-module/package.json
+++ b/packages/next-polyfill-module/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json
index 9f9af58b04041..45b0f7c596bdc 100644
--- a/packages/next-polyfill-nomodule/package.json
+++ b/packages/next-polyfill-nomodule/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
diff --git a/packages/next/next-server/lib/router/router.ts b/packages/next/next-server/lib/router/router.ts
index e59fada6cbb11..44cc9486e3959 100644
--- a/packages/next/next-server/lib/router/router.ts
+++ b/packages/next/next-server/lib/router/router.ts
@@ -163,7 +163,8 @@ export function delBasePath(path: string): string {
* Detects whether a given url is routable by the Next.js router (browser only).
*/
export function isLocalURL(url: string): boolean {
- if (url.startsWith('/')) return true
+ // prevent a hydration mismatch on href for url with anchor refs
+ if (url.startsWith('/') || url.startsWith('#')) return true
try {
// absolute urls can be local if they are on the same origin
const locationOrigin = getLocationOrigin()
diff --git a/packages/next/package.json b/packages/next/package.json
index 72971f31076f1..0269ad98907a7 100644
--- a/packages/next/package.json
+++ b/packages/next/package.json
@@ -1,6 +1,6 @@
{
"name": "next",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
@@ -63,10 +63,10 @@
"@ampproject/toolbox-optimizer": "2.7.1-alpha.0",
"@babel/runtime": "7.12.5",
"@hapi/accept": "5.0.1",
- "@next/env": "10.0.6-canary.2",
- "@next/polyfill-module": "10.0.6-canary.2",
- "@next/react-dev-overlay": "10.0.6-canary.2",
- "@next/react-refresh-utils": "10.0.6-canary.2",
+ "@next/env": "10.0.6-canary.3",
+ "@next/polyfill-module": "10.0.6-canary.3",
+ "@next/react-dev-overlay": "10.0.6-canary.3",
+ "@next/react-refresh-utils": "10.0.6-canary.3",
"@opentelemetry/api": "0.14.0",
"ast-types": "0.13.2",
"browserslist": "4.14.6",
@@ -138,7 +138,7 @@
"@babel/preset-react": "7.12.10",
"@babel/preset-typescript": "7.12.7",
"@babel/types": "7.12.12",
- "@next/polyfill-nomodule": "10.0.6-canary.2",
+ "@next/polyfill-nomodule": "10.0.6-canary.3",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json
index 62a141c5a648d..7387d30b2814a 100644
--- a/packages/react-dev-overlay/package.json
+++ b/packages/react-dev-overlay/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
@@ -30,7 +30,6 @@
},
"peerDependencies": {
"react": "^16.9.0 || ^17",
- "react-dom": "^16.9.0 || ^17",
- "webpack": "^4 || ^5"
+ "react-dom": "^16.9.0 || ^17"
}
}
diff --git a/packages/react-dev-overlay/src/middleware.ts b/packages/react-dev-overlay/src/middleware.ts
index baef529cb450d..b27e6cb25da6e 100644
--- a/packages/react-dev-overlay/src/middleware.ts
+++ b/packages/react-dev-overlay/src/middleware.ts
@@ -9,8 +9,8 @@ import {
} from 'source-map'
import { StackFrame } from 'stacktrace-parser'
import url from 'url'
-// eslint-disable-next-line import/no-extraneous-dependencies
// @ts-ignore
+// eslint-disable-next-line import/no-extraneous-dependencies
import webpack from 'webpack'
import { getRawSourceMap } from './internal/helpers/getRawSourceMap'
import { launchEditor } from './internal/helpers/launchEditor'
diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json
index 850486aeea2a8..603e840c342c2 100644
--- a/packages/react-refresh-utils/package.json
+++ b/packages/react-refresh-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
- "version": "10.0.6-canary.2",
+ "version": "10.0.6-canary.3",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
@@ -22,6 +22,11 @@
"react-refresh": "0.8.3",
"webpack": "^4 || ^5"
},
+ "peerDependenciesMeta": {
+ "webpack": {
+ "optional": true
+ }
+ },
"devDependencies": {
"react-refresh": "0.8.3"
}
diff --git a/test/integration/link-with-hash/pages/index.js b/test/integration/link-with-hash/pages/index.js
new file mode 100644
index 0000000000000..f39a8ed7342d2
--- /dev/null
+++ b/test/integration/link-with-hash/pages/index.js
@@ -0,0 +1,14 @@
+import React from 'react'
+import Link from 'next/link'
+
+const Home = () => {
+ return (
+ <>
+
+ Hash Link
+
+ >
+ )
+}
+
+export default Home
diff --git a/test/integration/link-with-hash/test/index.test.js b/test/integration/link-with-hash/test/index.test.js
new file mode 100644
index 0000000000000..365cade8ad9bb
--- /dev/null
+++ b/test/integration/link-with-hash/test/index.test.js
@@ -0,0 +1,53 @@
+/* eslint-env jest */
+
+import { join } from 'path'
+import webdriver from 'next-webdriver'
+import {
+ findPort,
+ launchApp,
+ killApp,
+ nextStart,
+ nextBuild,
+} from 'next-test-utils'
+
+jest.setTimeout(1000 * 60 * 5)
+let app
+let appPort
+const appDir = join(__dirname, '..')
+
+const runTests = () => {
+ it('should not have hydration mis-match for hash link', async () => {
+ const browser = await webdriver(appPort, '/')
+ const browserLogs = await browser.log('browser')
+ let found = false
+ browserLogs.forEach((log) => {
+ if (log.message.includes('Warning: Prop')) {
+ found = true
+ }
+ })
+ expect(found).toEqual(false)
+ })
+}
+
+describe('Link with hash href', () => {
+ describe('development', () => {
+ beforeAll(async () => {
+ appPort = await findPort()
+ app = await launchApp(appDir, appPort)
+ })
+ afterAll(() => killApp(app))
+
+ runTests()
+ })
+
+ describe('production', () => {
+ beforeAll(async () => {
+ await nextBuild(appDir)
+ appPort = await findPort()
+ app = await nextStart(appDir, appPort)
+ })
+ afterAll(() => killApp(app))
+
+ runTests()
+ })
+})