status
stringclasses
1 value
repo_name
stringclasses
13 values
repo_url
stringclasses
13 values
issue_id
int64
1
104k
updated_files
stringlengths
11
1.76k
title
stringlengths
4
369
body
stringlengths
0
254k
issue_url
stringlengths
38
55
pull_url
stringlengths
38
53
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
closed
vercel/next.js
https://github.com/vercel/next.js
30,953
["packages/next/server/base-http/node.ts", "packages/next/server/body-streams.ts", "packages/next/server/next-server.ts", "packages/next/server/web/adapter.ts", "packages/next/server/web/types.ts", "test/production/reading-request-body-in-middleware/index.test.ts", "yarn.lock"]
Middleware in API have a null body on POST Requests
### What version of Next.js are you using? 12.0.2 ### What version of Node.js are you using? v14.18.0 ### What browser are you using? Chrome ### What operating system are you using? Linux ### How are you deploying your application? next dev, next start, Vercel ### Describe the Bug When sending a POST request that gets handled by middleware in the /pages/api folder, the request body is always null. So, in the client side (`/pages/index.tsx`) we have: ```const sendPost = () => { fetch("/api/middlewaretest", { method: "post", body: JSON.stringify({ hello: "world" }), headers: { "content-type": "application/json" }, }) .then((res) => res.json()) .then((res) => console.log(res)) .catch((e) => { console.error(e); }); }; ``` In `/api/middlewaretest/_middleware.ts` we have: ```import type { NextFetchEvent, NextRequest } from "next/server"; export function middleware(req: NextRequest, ev: NextFetchEvent) { console.log("method", req.method); // will be post console.log("bodyUsed", req.bodyUsed); // will be false console.log("headers", req.headers); // shows proper content type and content length console.log("body", req.body); // always null! /*** * * If middleware is async and I try any of the following: * * await res.json() // TypeError: invalid json body reason: Unexpected end of JSON input * await res.text() // blank string * */ return new Response(JSON.stringify({ message: "hello world!" }), { status: 200, headers: { "Content-Type": "application/json", }, }); } ``` ### Expected Behavior In https://nextjs.org/docs/api-reference/next/server#nextrequest it notes that `NextRequest` is an extension of the native `Request` interface which should provide a stream on `req.body` that could be read. However, it always comes across as null. ### To Reproduce 1. Clone `https://github.com/idreaminteractive/nextjs-middleware-body` 2. `yarn` 3. `yarn dev` (or `yarn build && yarn start`) 4. Goto `http://localhost:3000` 5. Press the `Send the post` button to trigger the middleware, check the console logs to see `req.body` is always null for a `POST` request. The second button (Send the post to hello) is a regular NextJS API end point and works fine.
https://github.com/vercel/next.js/issues/30953
https://github.com/vercel/next.js/pull/34519
204a95586dccefb24bc0790f2a39f267310dc402
8752464816e992b6c37100bc89692cf8af1dfb75
"2021-11-04T13:23:50Z"
javascript
"2022-02-18T19:43:43Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,921
["errors/manifest.json", "errors/no-server-import-in-page.md", "packages/eslint-plugin-next/lib/rules/no-server-import-in-page.js", "test/unit/eslint-plugin-next/no-server-import-in-page.test.ts"]
Lint warning if you use next/server outside of Middleware
### Describe the feature you'd like to request Unintentionally, some folks have used `next/server` in normal Next.js pages outside of Middleware. ### Describe the solution you'd like Have a lint warning or error if `next/server` is used outside Middleware. ### Describe alternatives you've considered N/A
https://github.com/vercel/next.js/issues/30921
https://github.com/vercel/next.js/pull/30973
4a22059b118c6c6531bb1d72e71b323713ee8376
d1adf1d5039fa3cba78409509f80b3958b60eeaa
"2021-11-03T22:21:31Z"
javascript
"2021-11-12T23:44:39Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,911
["packages/next/server/web/sandbox/sandbox.ts", "test/integration/middleware/core/pages/interface/_middleware.js", "test/integration/middleware/core/test/index.test.js"]
[Middleware] Support browser Uint8Array instead of Node's version
### What version of Next.js are you using? latest ### What version of Node.js are you using? 14.17.6 ### What browser are you using? Chrome ### What operating system are you using? WSL ### How are you deploying your application? Vercel ### Describe the Bug When using third party modules that work in the browser, and that should work in Next.js Middleware, if the module checks that an object is an instance of a JS constructor, like `Uint8Array`, that's gonna fail locally, as it will match its Node.js version, even if it has the same name. So for example the code in the example below works in Vercel, but fails in localhost: ```ts export async function setUserCookie( request: NextRequest, response: NextResponse ) { const cookie = request.cookies[USER_TOKEN] if (!cookie) { const token = await new SignJWT({}) .setProtectedHeader({ alg: 'HS256' }) .setJti(nanoid()) .setIssuedAt() .setExpirationTime('2h') // This will fail because sign() is expecting the browser's Uint8Array .sign(new TextEncoder().encode(JWT_SECRET_KEY)) response.cookie(USER_TOKEN, token, { httpOnly: true }) } return response } ``` [Source](https://github.com/vercel/examples/blob/main/edge-functions/jwt-authentication/lib/auth.ts#L45-L50) ### Expected Behavior When using Middleware, JS internals should be browser compatible, and don't come from Node.js. ### To Reproduce Run this example locally: https://github.com/vercel/examples/blob/main/edge-functions/jwt-authentication
https://github.com/vercel/next.js/issues/30911
https://github.com/vercel/next.js/pull/31043
764e29c170ce2c1c779329d3ab16a15caa00081a
0985b0b472a30a29436ea5417b00ca97b82c3bc3
"2021-11-03T19:51:24Z"
javascript
"2021-11-09T19:57:19Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,876
["packages/next/server/render.tsx", "test/integration/react-18/app/pages/use-id.js", "test/integration/react-18/test/basics.js"]
React 18: `useId` usage results in hydration mismatch
### What version of Next.js are you using? 12.0.2 and 12.0.3-canary.2 ### What version of Node.js are you using? 12.22.6 ### What browser are you using? Version 95.0.4638.54 (Official Build) (64-bit) ### What operating system are you using? Ubuntu 20.04.3 LTS ### How are you deploying your application? next dev ### Describe the Bug React version: 18.0.0-alpha-00ced1e2b-20211102 Render a component using [`React.useId`](https://github.com/reactwg/react-18/discussions/111) ### Expected Behavior No hydration mismatch ### To Reproduce ```bash $ git clone https://github.com/eps1lon/next-react-18-useid.git $ cd next-react-18-useid $ yarn $ yarn dev # Open http://localhost:3000/ # Hydration mismatch (see console) ``` Also reproduces with `[email protected]`, `reactStrictMode = false` and `experimental.concurrentFeatures = true`
https://github.com/vercel/next.js/issues/30876
https://github.com/vercel/next.js/pull/31102
87c4d17726ce060519d4170d00e645ac988a03a3
960298b3447f8476a43f29d2badb125b697ffff0
"2021-11-03T10:29:00Z"
javascript
"2021-11-08T23:32:06Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,839
["packages/next/build/swc/Cargo.lock"]
Next 12 Runtime TypeError: Class constructors cannot be invoked without 'new'
### What version of Next.js are you using? 12.0.2 ### What version of Node.js are you using? 16.13.0 ### What browser are you using? Chrome 96 ### What operating system are you using? MacOS ### How are you deploying your application? next start ### Describe the Bug While updating my application from next 11 to 12 I ran into a runtime issue which I'm guessing is originating from the switch to SWC (?). I'm extending a Class and instantiating it, leading to a runtime error: ```javascript Unhandled Runtime Error TypeError: Class constructors cannot be invoked without 'new' pages/index.tsx (7:15) @ new newClient 5 | import { Client } from '@spree/storefront-api-v2-sdk'; 6 | > 7 | class newClient extends Client { | ^ 8 | constructor(config: any) { 9 | super(config); 10 | } ``` ### Expected Behavior The application should run / build successfully as it did in Next 11. ### To Reproduce 1. Install next 12 / typescript: `npx create-next-app@latest --typescript poc` 2. Apply patch to reproduce the issue: ```patch diff --git a/package.json b/package.json index 2f98703..e2de6ca 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "lint": "next lint" }, "dependencies": { + "@spree/storefront-api-v2-sdk": "^4.11.0", "next": "12.0.2", "react": "17.0.2", "react-dom": "17.0.2" diff --git a/pages/index.tsx b/pages/index.tsx index 72a4a59..23e7ec6 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -2,6 +2,17 @@ import type { NextPage } from 'next' import Head from 'next/head' import Image from 'next/image' import styles from '../styles/Home.module.css' +import { Client } from '@spree/storefront-api-v2-sdk'; + +class newClient extends Client { + constructor(config: any) { + super(config); + } +} + +const v2Client = new newClient({ + host: 'https://localhost:3000/', +}); const Home: NextPage = () => { return ( ``` 3. install deps: `npm install` 4. start the development server (`npm dev`) and visit the site
https://github.com/vercel/next.js/issues/30839
https://github.com/vercel/next.js/pull/31233
e1464ae5a5061ae83ad015018d4afe41f91978b6
24f7c2173626d9dff996d57ba60c6c934c11658c
"2021-11-02T19:59:09Z"
javascript
"2021-11-10T09:06:04Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,822
["docs/advanced-features/output-file-tracing.md", "packages/next/server/config.ts"]
Incomplete and unclear documentation on how to get rid of target: serverless on next config js
### What version of Next.js are you using? 12.0.2 ### What version of Node.js are you using? 14.17.6 ### What browser are you using? Chrome ### What operating system are you using? MacOs ### How are you deploying your application? Serverless ### Describe the Bug Hello, I updated to next js v12 today, and after reading the breaking changes in the blog I saw that the option `target: serverless` on the next.config.js file is going to be deprecated in a future version. (In the blog is written as a breaking change, as if it will make the app not work from this recently released version, which doesn't seem to be the case). There is a link to explain how to "possibly" solve it, but the documentation is extremely poor. It generates us more questions than answers. I open this issue as a bug, because to have good documentation should be part of such a major release. ### Expected Behavior It would be really nice to have a more extended and detailed documentation, including code samples. Having a guide for specific for when using Serverless would be amazing. ### To Reproduce Visit https://nextjs.org/docs/advanced-features/output-file-tracing
https://github.com/vercel/next.js/issues/30822
https://github.com/vercel/next.js/pull/32255
a5b3f56ff860efde0b359a885ef3b2e81bb60b46
1a6a1e5fdfcc6c9d829d89b337852a55f7e72960
"2021-11-02T15:27:32Z"
javascript
"2021-12-07T23:22:21Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,811
["errors/experimental-jest-transformer.md", "errors/manifest.json", "jest.config.js", "package.json", "packages/next/build/swc/jest.js", "packages/next/build/swc/options.js", "packages/next/build/webpack/loaders/next-swc-loader.js", "packages/next/jest.js", "yarn.lock"]
Add Jest transformer using next-swc
We have to add a Jest transformer that leverages `next-swc` so that people don't have to opt-out of using `next-swc` just to transform tests as it generally requires a `.babelrc` with `next/babel` in order to compile components correctly.
https://github.com/vercel/next.js/issues/30811
https://github.com/vercel/next.js/pull/30993
83cd45215affb5103dae9009c7c19b1bf97114ea
bc88831619f45357d8ee68b6b2b3abf4690d38e8
"2021-11-02T12:10:00Z"
javascript
"2021-11-08T16:35:04Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,810
["packages/next/build/swc/crates/core/src/disallow_re_export_all_in_page.rs", "packages/next/build/swc/crates/core/src/lib.rs", "packages/next/build/swc/crates/core/tests/errors.rs", "packages/next/build/swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/input.js", "packages/next/build/swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.js", "packages/next/build/swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr", "packages/next/build/swc/crates/core/tests/errors/re-export-all-in-page/re-export-default/input.js", "packages/next/build/swc/crates/core/tests/errors/re-export-all-in-page/re-export-default/output.js"]
Port next-page-disallow-re-export-all-exports plugin to next-swc
This transform disallows re-exporting `*`. It wasn't ported to next-swc yet as we prioritized other transforms but would be good to add this back as it prevents a pitfall where getStaticProps/getServerSideProps can't be tree-shaken from the page.
https://github.com/vercel/next.js/issues/30810
https://github.com/vercel/next.js/pull/31582
a363a4ff6c0f285dc7a1bb770218e45d7da634a8
1d2ac3b225e7fc29e15789024731611d4753fb7a
"2021-11-02T12:08:05Z"
javascript
"2021-11-19T00:11:25Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,802
["Cargo.lock", "Cargo.toml", "packages/next-swc/crates/core/Cargo.toml", "packages/next-swc/crates/core/src/lib.rs", "packages/next/package.json", "pnpm-lock.yaml"]
Port babel-plugin-styled-components to SWC
This Babel plugin is the most used customization of `.babelrc`. The plugin is split up in multiple separate transforms: [https://github.com/styled-components/babel-plugin-styled-components/blob/a26774e599c82c72e8793989f60310d29c181fac/src/index.js](https://github.com/styled-components/babel-plugin-styled-components/blob/a26774e599c82c72e8793989f60310d29c181fac/src/index.js) The defaults are here: [https://github.com/styled-components/babel-plugin-styled-components/blob/950692b92855f17609e4281d5081e3d2acbf4b6b/src/utils/options.js](https://github.com/styled-components/babel-plugin-styled-components/blob/950692b92855f17609e4281d5081e3d2acbf4b6b/src/utils/options.js) The critical one which makes styled-components not have hydration issues with Next.js is `displayNameAndId`. All the other ones seem to be optimizations. Because of this I'd start by porting the `displayNameAndId` transform and then check what else can be ported. Looking at the defaults the only transform that is disabled by default is the pure annotations one. List of transforms: - [x] ssr -- enabled when `styledComponents: true` - [x] displayName -- enabled when `styledComponents: true`, disabled in production to reduce file size - [x] css prop - [x] fileName - [x] minify - [x] transpileTemplateLiterals - [x] pure - [x] namespace
https://github.com/vercel/next.js/issues/30802
https://github.com/vercel/next.js/pull/58517
4d330a850062e844226c0c53cecf3fec410a8de1
8e6d51f4fa9aa015552f1dc1722540c986a71c06
"2021-11-02T11:48:50Z"
javascript
"2023-11-27T10:02:25Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,800
["packages/next-swc/Cargo.lock", "packages/next-swc/crates/core/Cargo.toml", "packages/next-swc/crates/napi/Cargo.toml", "packages/next-swc/crates/wasm/Cargo.toml"]
Double const compiled to var instead of erroring
From @sokra: I noticed that SWC transpiles that: ``` const Thing = 1 const Thing = 2 ``` to ``` var Thing = 1 var Thing = 2 ``` but instead that should be an error as Thing is declared twice
https://github.com/vercel/next.js/issues/30800
https://github.com/vercel/next.js/pull/32664
e29699b68377ebc681b681644139d1039b965836
026dd4cea0e35a54d0d0ec9be2ff35b063878300
"2021-11-02T11:39:07Z"
javascript
"2021-12-20T10:55:26Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,799
["packages/next/build/swc/src/styled_jsx/mod.rs", "packages/next/build/swc/tests/fixture/styled-jsx/styles/input.js", "packages/next/build/swc/tests/fixture/styled-jsx/styles/output.js"]
styled-jsx issue with interpolation when SWC is enabled
Report: [https://vercel.slack.com/archives/C0290CZ3U6Q/p1635502416198300?thread_ts=1635325628.111200&cid=C0290CZ3U6Q](https://vercel.slack.com/archives/C0290CZ3U6Q/p1635502416198300?thread_ts=1635325628.111200&cid=C0290CZ3U6Q) @delbaoliveira investigated it: Hey @timneutkens So I narrowed their issue down. They are using an integer as a variable when combining the [https://github.com/vercel/styled-jsx#dynamic-styles](https://github.com/vercel/styled-jsx#dynamic-styles) and [https://github.com/vercel/styled-jsx#external-css-and-styles-outside-of-the-component](https://github.com/vercel/styled-jsx#external-css-and-styles-outside-of-the-component) styled-jsx features. - Summary below and full reproduction here: [https://github.com/delbaoliveira/styled-1/blob/main/pages/index.js](https://github.com/delbaoliveira/styled-1/blob/main/pages/index.js) - I am unsure if these combinations are supposed to work in SWC or if they unintentionally worked by chance in Babel ``` const paddingInt = 10 const paddingStr = "10" // ✅ babel // ❌ swc const Test1 = () => (  <div>   <p>test 1</p>   <style jsx>{styles1}</style>  </div> ) const styles1 = css`  p {   color: red;  }  .something-else {   padding: ${paddingInt}px;  } ` ``` - Using an integer variable works with Babel but doesn't work in SWC - Using a string as a variable works in both Babel and SWC ``` const paddingInt = 10 // ✅ babel // ✅ swc const Test2 = () => (  <div>   <p>test 2</p>   <style jsx>{`    p {     color: red;    }    .something-else {     padding: ${paddingInt}px;    }   `}</style>  </div> ) ``` - Using an integer in an inline style worked in both Babel and SWC ``` import { paddingStrExternal } from "../lib/external" // ✅ babel // ❌ swc const Test7 = () => (  <div>   <p>test 7</p>   <style jsx>{styles7}</style>  </div> ) const styles7 = css`  p {   color: red;  }  .something-else {   padding: ${paddingStrExternal}px;  } ` ``` - Importing a string variable from another file did not work in SWC, but worked in Babel. I also tested a few different variations like `css.resolve` which worked in both.
https://github.com/vercel/next.js/issues/30799
https://github.com/vercel/next.js/pull/30928
5de4f668edb34273bc860055f37abfbab964cbb9
ec1919822790a5106b7df2640b474748e4ac863d
"2021-11-02T11:34:43Z"
javascript
"2021-11-04T09:24:21Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,798
["packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js"]
Minify breaks on some middleware
Problem middleware: [https://github.com/leerob/leerob.io/blob/main/pages/_middleware.ts](https://github.com/leerob/leerob.io/blob/main/pages/_middleware.ts) Error and workaround: [https://github.com/vercel/next.js/pull/30122](https://github.com/vercel/next.js/pull/30122) Note: Does not present itself in `next start`
https://github.com/vercel/next.js/issues/30798
https://github.com/vercel/next.js/pull/30823
cbc52d1b314114f29064949ed71ea5255b3b8b78
c8d0a1bc0bf32981a280c19e0492e869b45a319c
"2021-11-02T11:29:16Z"
javascript
"2021-11-02T17:37:50Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,791
["packages/next/build/webpack-config.ts", "test/integration/middleware/hmr/pages/_middleware.js", "test/integration/middleware/hmr/pages/about/_middleware.js", "test/integration/middleware/hmr/pages/about/a.js", "test/integration/middleware/hmr/pages/about/b.js", "test/integration/middleware/hmr/pages/index.js", "test/integration/middleware/hmr/test/index.test.js"]
NextJS Hot Reload
### What version of Next.js are you using? 12.0.2 ### What version of Node.js are you using? 14.17.1 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Local ### Describe the Bug NextJS keeps refreshing when code is updated, the log below shows what happens I've read about the warning in other issues, but didn't have it prior to upgrading to next 12 while ``` _devMiddlewareManifest ``` is new couldn't reproduce due to the fact the project is actually big and was working fine prior to upgrading any update is causing a refresh ![image](https://user-images.githubusercontent.com/57658626/139824636-199eedcd-7ca1-4b90-8b1a-bb58c41f36bf.png) ### Expected Behavior The page shouldn't be refreshing ### To Reproduce Upgraded to next 12.0.2 and used a middleware in a subfolder (nothing else)
https://github.com/vercel/next.js/issues/30791
https://github.com/vercel/next.js/pull/31548
01cf08e288779c37e22179b9c3981766f60b7573
5a3d558c9fdadd65d8ec17af1a4548beb25cde82
"2021-11-02T09:54:43Z"
javascript
"2021-11-18T18:23:52Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,766
["packages/next-swc/Cargo.lock", "packages/next-swc/crates/core/Cargo.toml", "packages/next-swc/crates/core/tests/loader/issue-30389/input.js", "packages/next-swc/crates/core/tests/loader/issue-30389/output.js", "packages/next-swc/crates/core/tests/loader/issue-30766/input.js", "packages/next-swc/crates/core/tests/loader/issue-30766/output.js", "packages/next-swc/crates/napi/Cargo.toml", "packages/next-swc/crates/wasm/Cargo.toml"]
TypeScript: Object deconstruction with alias and default value does not work
### What version of Next.js are you using? 12.0.2 ### What version of Node.js are you using? 16.4.0 ### What browser are you using? Edge, Chrome ### What operating system are you using? Windows 11 ### How are you deploying your application? next dev ### Describe the Bug Here's a TypeScript code snippet ``` const value = { ho: [1, 2] }; const { ho: hey = [] } = value; console.log(hey); ``` Output is `[]` Must be `[1, 2]` Once you remove the "default value" or aliasing - it works normally. `tsconfig.json` -> `compilerOptions` -> `"target": "es5", "module": "commonjs", "lib": ["dom", "dom.iterable", "esnext"]` Reverting back to `"next": "11.1.2"` immediately fixes the issue. ### Expected Behavior Should be deconstructing objects properly, assigning the default value only when the provided one is not defined. I can just imagine it's somehow connected with the new Rust compiler. ### To Reproduce See above
https://github.com/vercel/next.js/issues/30766
https://github.com/vercel/next.js/pull/31816
b2acdbb788e48be4758f7555ae5fbe5ec5163eff
cfe561eae27e1eadb6372c8a90739ccc44092261
"2021-11-01T21:27:07Z"
javascript
"2021-11-26T09:01:30Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,739
["packages/next/build/webpack-config.ts", "test/production/edge-runtime-is-addressable/index.test.ts"]
[middlewares via Edge Functions] fetch is not complete, runtime is not addressable
### What version of Next.js are you using? 12.0.4-canary.15 ### What version of Node.js are you using? v14.18.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug Cloudflare Workers, which powers Edge Functions, has a caveat in the `fetch` implementation. The `referrerPolicy`, `credentials`, and `mode` options cannot be used. When used the code will throw/reject. This is fine in Cloudflare Workers since it's easy to detect that javascript runtime using something along the lines of `typeof WebSocketPair === 'function'`, but it is not fine for Edge Functions since that global context (e.g. WebSocketPair) is not reachable. Without a way to detect Edge Function runtime it is not possible to write universal code that uses these options in the browser but omits using them in Edge Functions. ### Expected Behavior It is possible to uniquely detect the runtime so that workarounds in universal libraries can be made to target said runtime. If there's a global that is unique to Edge Functions / Middlewares, we can use that, if not, add something fixed to process.env instead? ### To Reproduce This works in `next dev` but fails deployed to vercel.com. If a universal library does this, it needs a way to detect Edge Functions are used as a runtime to omit adding the `referrerPolicy`, `credentials`, and `mode` options. ```js export async function middleware(req, ev) { let fetchFailed = false; try { await fetch(new URL('https://www.googleapis.com/oauth2/v3/certs'), { redirect: 'manual', method: 'GET', referrerPolicy: 'no-referrer', credentials: 'omit', mode: 'cors', }) } catch (err) { fetchFailed = err.stack } return new Response(JSON.stringify({ fetchFailed, }), { status: 200 }); } ```
https://github.com/vercel/next.js/issues/30739
https://github.com/vercel/next.js/pull/38288
e6bad25b5e4f7a5991d602c03f8396785efaaf09
672736c408c014c6a3c60eca2203da437950f29d
"2021-11-01T13:37:45Z"
javascript
"2022-07-04T12:54:07Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,720
["docs/api-reference/next.config.js/rewrites.md"]
App is rendered twice with rewrites
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 16.13.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? npm run dev ### Describe the Bug I'm developing multi-regional website. I would like to show a location confirmation pop-up on the client side. _app.tsx ``` const store = initializeStore({ geolocation: { isConfirm: true, /** I use this flag to conditionally display of the pop-up **/ } }) ``` store.ts ``` export const initializeStore = (preloadedState?: Partial<RootState>) => { return configureStore({ reducer: rootReducer, preloadedState, }) } ``` Geo.tsx ``` const dispatch: AppDispatch = useDispatch() const geolocation = useSelector(geolocationSelector) useEffect(() => { const localityCode = Cookies.get('localityCode') if (localityCode !== geolocation.locality?.code) { dispatch(toggleGeoConfirmAction(false)) } }, []) ``` next.config.js ``` async rewrites() { return { afterFiles: [ { source: '/:path(.*)', has: [ { type: 'host', value: '(?<host>.*)', }, ], destination: '/hosts/:host/:path*', }, ], } }, ``` I've found out that storage initialization happens twice due to rewrite rules. So: 1. The storage is being created 2. Works useEffect and dispatches the action 3. But after that my state is being reset because _app is being rendered again ### Expected Behavior Maybe the page should be rendered once when we use rewrites. Also I've heard about router.isReady but it's inconvenient to use it everywhere to dispatch an action. https://github.com/vercel/next.js/tree/canary/examples/with-redux Or you can edit this example to show how to workaround this behavior ### To Reproduce next.config.js ``` async rewrites() { return { afterFiles: [ { source: '/:path(.*)', has: [ { type: 'host', value: '(?<host>.*)', }, ], destination: '/hosts/:host/:path*', }, ], } }, ``` _app.tsx ``` console.log('app render') ``` You'll see that app is rendered twice
https://github.com/vercel/next.js/issues/30720
https://github.com/vercel/next.js/pull/30747
147b0f9ebc93d18d58ff59729f0cd91308e89245
7cd9ffc519c7b81f198dc6171c4c59418c5f15f3
"2021-11-01T08:04:15Z"
javascript
"2021-11-02T10:17:09Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,714
["packages/next/build/entries.ts", "packages/next/build/webpack-config.ts", "packages/next/build/webpack/loaders/next-middleware-ssr-loader/index.ts", "packages/next/pages/_document.web.tsx", "packages/next/server/dev/hot-reloader.ts", "packages/next/taskfile.js", "test/integration/react-streaming-and-server-components/test/index.test.js"]
When concurrentFeatures is enabled and pageExtension options is used, custom _app file does not seem to be found and run properly
### What version of Next.js are you using? ^12.0.2-canary.14 ### What version of Node.js are you using? v16.13.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? tested on localhost ### Describe the Bug * I enabled experimental concurrentFeatures in my `next.config.js` * I added pageExtension options like `["page.js"]` * I created custom app file (_app.js) and it includes `QueryClientProvider` provided `react-query`. And I expected nextjs will find `_app.page.js` file properly. * However, I don't think nextjs find _app file properly. And, I am getting the error like below. ```Error: No QueryClient set, use QueryClientProvider to set one at useQueryClient (webpack://_N_E/./node_modules/react-query/es/react/QueryClientProvider.js?:33:11) at Home (webpack://_N_E/./pages/index.page.js?:20:84) at renderWithHooks (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5212:16) at renderIndeterminateComponent (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5285:15) at renderElement (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5467:7) at renderNodeDestructive (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5606:11) at finishClassComponent (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5242:3) at renderClassComponent (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5250:3) at renderElement (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5464:7) at renderNodeDestructive (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5606:11) error - unhandledRejection: Error: No QueryClient set, use QueryClientProvider to set one ``` ### Expected Behavior I expected it would work properly. If I have misunderstanding on the feature. Please let me know. ### To Reproduce * clone source code from [this repository](https://github.com/seonghyeonkimm/issue-nextjs-provider) * install dependencies and try to run `yarn dev` * next app throw the error mentioned above.
https://github.com/vercel/next.js/issues/30714
https://github.com/vercel/next.js/pull/30963
9da6cf2541c62dca69bb648c1124ca5394aec752
0c494af97c8dd8fdb858a55d186f8fbb04ec8fd4
"2021-11-01T04:53:55Z"
javascript
"2021-11-04T19:10:07Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,710
["packages/next/client/dev/amp-dev.js", "packages/next/client/dev/on-demand-entries-client.js", "test/.eslintrc.json", "test/integration/dynamic-routing/test/index.test.js", "test/lib/browsers/base.ts", "test/lib/browsers/playwright.ts"]
Invalid HMR message..Error: No router instance found. ???
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 17.0.1 ### What browser are you using? Chrome / Safari ### What operating system are you using? macOS ### How are you deploying your application? dev ### Describe the Bug While loading in locally developed npm packages, I get a weird warning in the console: `[Warning] Invalid HMR message: {"action":"sync","hash":"","warnings":[],"errors":[]} Error: No router instance found. You should only use "next/router" on the client side of your app. ` This current app is a test app that has no router instance anywhere, its just one page so the error doesn't really make sense. The npm package is adding styles to the _app.tsx (global style) and an Icon component to the index.tsx file. Chrome gives the same warning only on initial load but the warning goes away after that ### Expected Behavior The expected behaviour would be no hmr warning ### To Reproduce Not sure how others can reproduce the error since its kinda random
https://github.com/vercel/next.js/issues/30710
https://github.com/vercel/next.js/pull/31588
9f7c774665bbbd0adef14c5264530eda4132c92c
1d9007307fe335fcf9d40401e6b402267917a044
"2021-10-31T22:58:05Z"
javascript
"2021-11-18T22:23:21Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,698
["packages/next/build/entries.ts", "test/integration/404-page/pages/invalidExtension.d.ts", "test/integration/404-page/test/index.test.js", "test/integration/page-extensions/pages/invalidExtension.d.ts", "test/integration/page-extensions/test/index.test.js"]
Support `.d.ts` in `pages` directory
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? any ### What browser are you using? any ### What operating system are you using? any ### How are you deploying your application? any ### Describe the Bug Currently if you have `pages/blog/something.d.ts` it will result in Next.js trying to use the `.d.ts` file as a page, however these only hold types and will fail to build. ### Expected Behavior The `.ts` matching has to be slightly stricter to not match `.d.ts`, so that the application can build regardless of `.d.ts` being in the `pages` directory. ### To Reproduce `yarn create next-app my-app && cd my-app && yarn add typescript && mkdir -p pages/blog && touch pages/blog/something.d.ts` Then this in `pages/blog/something.d.ts`: ```ts export const container: string ``` Run `yarn build`: ```js yarn build yarn run v1.22.17 $ next build info - Checking validity of types info - Creating an optimized production build Failed to compile. ./pages/blog/something.d.ts Module parse failed: Unexpected token (1:22) File was processed with these loaders: * ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js You may need an additional loader to handle the result of these loaders. > export const container; | > Build failed because of webpack errors error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ```
https://github.com/vercel/next.js/issues/30698
https://github.com/vercel/next.js/pull/30728
d72f5bd69dcd243645ce43722cd86db030b94e1e
9d1fbbca7baa9a36d6bfc7b2fae3a519f3165794
"2021-10-31T12:48:14Z"
javascript
"2022-01-01T17:16:03Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,692
["examples/progressive-web-app/package.json", "yarn.lock"]
PWA not working in production
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.17.4 ### What browser are you using? Chrome ### What operating system are you using? Windows ### How are you deploying your application? Vercel ### Describe the Bug I implemented PWA using `next-pwa` in my application, and went through all the necessary steps. ( creating service worker, next-config file, etc ). Everything looks fine in development - "**Install app**" option pops up . But in production it just seems to disappear, and not even shows the install option ### Expected Behavior PWA pop-up should both appear in development as well as in production. ### To Reproduce - Install `next-pwa` - Generate manifest ( using [Simicart](https://www.simicart.com/manifest-generator.html) ). - Creating `_document.js` and adding the necessary links. ```js import Document, { Html, Head, Main, NextScript } from "next/document"; class MyDocument extends Document { render() { return ( <Html> <Head> <link rel="manifest" href="/manifest.json" /> <link rel="apple-touch-icon" href="/icon.png"></link> <meta name="theme-color" content="#fff" /> </Head> <body> <Main /> <NextScript /> </body> </Html> ); } } export default MyDocument; ``` - Configure next-config file ```js const withPWA = require("next-pwa"); module.exports = withPWA({ pwa: { dest: "public", register: true, skipWaiting: true, }, }); ``` - Add following to `.gitginore` ``` # PWA files **/public/sw.js **/public/workbox-*.js **/public/worker-*.js **/public/sw.js.map **/public/workbox-*.js.map **/public/worker-*.js.map ``` Also followed according to [Nextjs pwa example](https://github.com/vercel/next.js/tree/canary/examples/progressive-web-app) For more details visit this [repo](https://github.com/GeoBrodas/adalat-court-management) Screenshots from Chrome dev tools - ![image](https://user-images.githubusercontent.com/68821192/139581812-0ddab0db-916e-4a8e-8f39-1d9aeed0d390.png) Production link - https://adaalat.vercel.app
https://github.com/vercel/next.js/issues/30692
https://github.com/vercel/next.js/pull/31734
4b538e9879540d28db4e3ded4fecf79823e2110c
226944d3d3a41a52cd5c6bbcec42b92fad731a49
"2021-10-31T11:50:45Z"
javascript
"2021-11-23T16:17:56Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,683
["packages/next/build/swc/Cargo.lock"]
ambiguous Error During compile whole app
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.0.0 ### What browser are you using? microsoft edge ### What operating system are you using? windows 11 ### How are you deploying your application? next dev ### Describe the Bug after compile my page it shows an error that said: wait - compiling... thread '<unnamed>' panicked at 'not implemented: regenerator: complex pattern in catch clause', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\swc_ecma_transforms_compat-0.47.1\src\es2015\regenerator\case.rs:1232:30 error - ./pages/auth/index.tsx Error: failed to process not implemented: regenerator: complex pattern in catch clause maybe its cause by SWC but it so ambiquous and nothing help me to figure out what exactly caused this error ! ### Expected Behavior compiled my code without error because on next 11 we don't have this error ### To Reproduce ![image](https://user-images.githubusercontent.com/65160744/139573510-ec62576c-2b6f-41eb-bf6c-8fe469e42b78.png)
https://github.com/vercel/next.js/issues/30683
https://github.com/vercel/next.js/pull/30859
5f19f766fdcad6efbfdb17777c0d7c364d408ba6
2004d491987069c216d93c482108eefccad80d9a
"2021-10-31T07:49:19Z"
javascript
"2021-11-03T08:31:31Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,651
["examples/with-mongodb/lib/mongodb.js", "examples/with-mongodb/package.json", "examples/with-mongodb/pages/index.js"]
Update MongoDB Next.js Template
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 16.13.0 ### What browser are you using? Brave ### What operating system are you using? Windows ### How are you deploying your application? npm run dev ### Describe the Bug Please update [`Next.js MongoDB` template](https://github.com/vercel/next.js/tree/canary/examples/with-mongodb), it's not working after running the app. It shows `.isConnected()` is not a function after using the code in my personal project. ### Expected Behavior Connected to database. ### To Reproduce Nothing to reproduce.
https://github.com/vercel/next.js/issues/30651
https://github.com/vercel/next.js/pull/30675
2bd296d4ef77ff7c580936746830a2e888360e29
b290a3dc38fedccf71b62c94eefc76af9aff1453
"2021-10-30T07:27:33Z"
javascript
"2021-11-30T21:50:50Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,636
["packages/next/build/swc/Cargo.lock", "packages/next/build/swc/Cargo.toml", "packages/next/build/swc/src/transform.rs"]
Failed to build nextjs app
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 12.22.5 ### What browser are you using? Librewolf ### What operating system are you using? Linux ### How are you deploying your application? Vercel ### Describe the Bug So i tried to build my nextjs app. Everything worked when i started a development server but failed when tried to build the app. ### Expected Behavior It should just build a production build ### To Reproduce ``` git clone https://github.com/thatcatdrout/catdrout.to yarn yarn build ```
https://github.com/vercel/next.js/issues/30636
https://github.com/vercel/next.js/pull/30790
7cd9ffc519c7b81f198dc6171c4c59418c5f15f3
e79f788f7437d9b87da09ff865c0135a141b25cc
"2021-10-29T20:26:27Z"
javascript
"2021-11-02T10:57:09Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,631
["packages/next/build/webpack/loaders/next-serverless-loader/utils.ts", "test/production/required-server-files-i18n.test.ts", "test/production/required-server-files/pages/[slug]/index.js", "test/production/required-server-files/pages/[slug]/social/[[...rest]].js"]
[i18n] i18n breaks optional catch-all route for index
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.16.0 ### What browser are you using? Chrome ### What operating system are you using? Linux ### How are you deploying your application? Vercel ### Describe the Bug Seems the same issue as #19934. It seems this was resolved, but somewhere along the way it broke again. We have a project with structure of pages/[userId]/social/[[...socialId]]: - /user-123/social: does not work when it should. - /user-123/social/social-123: work as expected - The issue only happens whenever the project is i18n configured. If I revert the Next.js version to 10.0.5-canary.9, it works again. ### Expected Behavior Both /user-123/social and /user-123/social/social-123 should work. ### To Reproduce 1. Go to [https://routing-test-peach.vercel.app](https://routing-test-peach.vercel.app) 2. Index page shows a 404 [ https://routing-test-peach.vercel.app/user-123/social](https://routing-test-peach.vercel.app/user-123/social) 3. Any other page will work [https://routing-test-peach.vercel.app/user-123/social/social-123](https://routing-test-peach.vercel.app/user-123/social/social-123) Repo for reproduction: [https://github.com/expjazz/routing-test](https://github.com/expjazz/routing-test)
https://github.com/vercel/next.js/issues/30631
https://github.com/vercel/next.js/pull/33896
7b1baceede9b473f634d8212a8f1c879c7a7ce1f
f841307fa02c399541488dc3261e2ec5efbcfadc
"2021-10-29T17:27:34Z"
javascript
"2022-02-02T19:02:03Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,612
["docs/api-reference/next/server.md"]
process.env is an empty object in _middleware.ts
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.18.1 ### What browser are you using? Brave ### What operating system are you using? macOS 11.5.2 ### How are you deploying your application? npm run dev and Vercel ### Describe the Bug Accessing `process.env` returns an empty object `{}` in `pages/_middleware.ts`. This happens locally when running `npm run dev` and also when app is deployed to Vercel. ### Expected Behavior Following the Vercel edge functions docs, environment variables should be available via `process.env`. https://vercel.com/docs/concepts/functions/edge-functions#environment ### To Reproduce Create a middleware file `pages/_middleware.ts`: ``` import { NextResponse } from 'next/server'; export function middleware() { console.log(process.env); return NextResponse.next(); } ``` Start the app, visit any page of the app and inspect console output.
https://github.com/vercel/next.js/issues/30612
https://github.com/vercel/next.js/pull/31237
e95c9caca3977a7e85b1d673882384d68d05726a
a371447555cbd44a315a7127c1af188cab60b8bb
"2021-10-29T10:20:28Z"
javascript
"2021-11-23T20:55:17Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,605
["packages/next/build/webpack/loaders/next-swc-loader.js", "test/integration/pnpm-support/app/pages/regenerator.js", "test/integration/pnpm-support/test/index.test.js"]
Module not found: Can't resolve 'regenerator-runtime' -- after upgrading from 11 to 12.0.2-canary.8
### What version of Next.js are you using? 12.0.2-canary.8 ### What version of Node.js are you using? 16.3.0 ### What browser are you using? Firefox ### What operating system are you using? macOS ### How are you deploying your application? yarn dev ### Describe the Bug Running `yarn build` defined as `"build": "next build"` in package.json throws an error in multiple files: `Module not found: Can't resolve 'regenerator-runtime' in '/Users/xxx/...'` ### Expected Behavior Since I have not changed anything but upgrading Next.js from 11 to 12, I expect it not to fail builds. ### To Reproduce Use yarn 3.0.2 and latest Next.js
https://github.com/vercel/next.js/issues/30605
https://github.com/vercel/next.js/pull/30786
e79f788f7437d9b87da09ff865c0135a141b25cc
64e414160d212cb32ce90979192c452aeee3a01e
"2021-10-29T08:00:04Z"
javascript
"2021-11-02T11:11:53Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,604
["packages/next/client/head-manager.ts"]
TypeError: Cannot read properties of null (reading 'tagName')
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.15.3 ### What browser are you using? Chrome ### What operating system are you using? macOS Big Sur ### How are you deploying your application? Vercel ### Describe the Bug During development, each refresh I get this error: `TypeError: Cannot read properties of null (reading 'tagName')` ![image](https://user-images.githubusercontent.com/10405556/139396841-d84d6fff-d8f2-4622-815b-80f205957a89.png) It comes from this component: ![image](https://user-images.githubusercontent.com/10405556/139396912-88211e0e-0936-4a3d-be12-5854165a35c8.png) In this case `<Picture />` is just a next/image, where the first image is loaded eagerly with priority Full error stack: ![image](https://user-images.githubusercontent.com/10405556/139397123-b4e7feff-b6e0-42f3-a129-e3316301e053.png) ### Expected Behavior Doesn't show the error ### To Reproduce Run component
https://github.com/vercel/next.js/issues/30604
https://github.com/vercel/next.js/pull/30919
c6c240302be71f61311c7e3898ed88a8e272678a
95182480bf4ecbfdfd2794a9a1274f1635b7bcd3
"2021-10-29T07:53:54Z"
javascript
"2021-11-04T00:24:12Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,592
["packages/next/build/swc/Cargo.lock"]
This is undefined in object getter
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? v14.18.0 ### What browser are you using? Chrome ### What operating system are you using? MacOs Monterey ### How are you deploying your application? Vercel ### Describe the Bug I'm a getting a `TypeError` when reading a property from `this` inside an object's getter. `this` is undefined when the object was returned by a function. ### Expected Behavior `this` should not be undefined. This worked on v11. ### To Reproduce Next@12 not working: https://replit.com/@francofantini/getter-bug Next@11 working: https://replit.com/@francofantini/getter-bug-1 Steps: 1. Create an function that returns an object with a getter ```js const navigation = (path) => [ { name: "Home", href: `/`, get current() { return this.href === path; }, }, { name: "Dashboard", href: `/dashboard`, get current() { return this.href === path; }, }, ]; ``` 2. Try reading the getter from inside a component ```js export default function Home() { // Works on the server, not on the client console.log(navigation('test')[0].current) return null; } ``` 3. The log gets output to the console, as this seems to work on the server 4. Error on the client ``` Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'href') ```
https://github.com/vercel/next.js/issues/30592
https://github.com/vercel/next.js/pull/30859
5f19f766fdcad6efbfdb17777c0d7c364d408ba6
2004d491987069c216d93c482108eefccad80d9a
"2021-10-29T03:34:19Z"
javascript
"2021-11-03T08:31:31Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,586
["test/integration/react-streaming-and-server-components/app/pages/api/ping.js", "test/integration/react-streaming-and-server-components/test/index.test.js"]
API routes don't return with concurrentFeatures
### What version of Next.js are you using? 12.0.2-canary.6 ### What version of Node.js are you using? 14.17.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug A freshly generated next app does not seem to allow API routes when concurrentFeatures is turned on. The browser never loads anything and the console displays output similar to the following: ``` wait - compiling /api/hello (server only)... wait - compiling... event - compiled successfully in 498 ms (281 modules) error - Error: Cannot find module for page: /api/hello wait - compiling /_error... wait - compiling... event - compiled successfully in 160 ms (284 modules) ``` ### Expected Behavior API routes to not be affected by concurrentFeatures. If I turn them off, the API routes load as expected. ### To Reproduce 1. Generate a new next app with `npx create-next-app --ts --use-npm` 2. `cd` into the new app directory and edit the next.config.js file to add the concurrentFeatures flag like so: ```js module.exports = { experimental: { concurrentFeatures: true } } ``` 3. Save and run `npm run dev` 4. Try to navigate to localhost:3000/api/hello 5. The page will never load and you will see the following error in the console: ``` Error: Cannot find module for page: /api/hello ```
https://github.com/vercel/next.js/issues/30586
https://github.com/vercel/next.js/pull/31227
7087adba122640085944bc6b1968857ff1b52897
e1464ae5a5061ae83ad015018d4afe41f91978b6
"2021-10-28T23:49:14Z"
javascript
"2021-11-09T22:48:46Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,570
["packages/next/build/swc/Cargo.lock", "packages/next/build/swc/Cargo.toml", "packages/next/build/swc/src/bundle/mod.rs", "packages/next/build/swc/src/styled_jsx/transform_css.rs", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30480/input.js", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30480/output.js", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30570/input.js", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30570/output.js", "packages/next/build/swc/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js"]
with next@12 some `@supports()` at-rules values become part of the styles
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.18.1 ### What browser are you using? Brave ### What operating system are you using? macOS ### How are you deploying your application? vercel ### Describe the Bug The value of some supports-at-rules become part of the css-output, e.g. ```tsx export default function IndexPage() { return ( <div> <h1>Hello World.</h1> <style jsx global>{` @supports (display: flex) { h1 { color: hotpink; } } `}</style> </div> ); } ``` will output the following css: ```css h1 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; color: hotpink; } ``` It doesn't happen for every display value, for example `display: grid` works as expected, but there are likely more css rules affected. ### Expected Behavior Obviously the value of a `@supports` at-rule should not become part of the css output. ### To Reproduce 1. visit this codesandbox: https://codesandbox.io/s/billowing-moon-xh6vi?file=/pages/index.js and go to step 4, or: 2. Install [email protected] 3. create the following page: ```tsx export default function IndexPage() { return ( <div> <h1>Hello World.</h1> <style jsx>{` @supports (display: flex) { h1 { color: hotpink; } } `}</style> </div> ); } ``` 4. inspect the title element 5. you should see the title element has `display: flex;`
https://github.com/vercel/next.js/issues/30570
https://github.com/vercel/next.js/pull/31407
aaec9a93536b2535a8c8af94b707e91d3e596a9a
6fd44383f3df859da6f1381b41c588919a29ca82
"2021-10-28T17:20:18Z"
javascript
"2021-11-15T08:27:45Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,567
["test/integration/scss-fixtures/external-url/pages/_app.js", "test/integration/scss-fixtures/external-url/pages/index.js", "test/integration/scss-fixtures/external-url/styles/global.scss", "test/integration/scss/test/index.test.js"]
CSS @import url for loading fonts doesnt work
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 17.0.1 ### What browser are you using? Firefox, Chrome ### What operating system are you using? Windows 10 ### How are you deploying your application? next start ### Describe the Bug App.scss: `@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');` Loading the font with next dev works but not with next build (next start). Tested with `optimizeFonts: false` but with same result. ### Expected Behavior In next 11.0.1 the font was imported correctly ### To Reproduce Inside App.scss `@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');` 1. next build 2. next start
https://github.com/vercel/next.js/issues/30567
https://github.com/vercel/next.js/pull/31691
feabd54f6b83a6572670323e43ae82b1919bc89c
d9712626036f7615677da89f2b51258d6a33e994
"2021-10-28T16:39:05Z"
javascript
"2021-11-22T15:09:57Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,561
["packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts"]
Cannot find module 'redux' (Deploy on Vercel w/ yarn workspace)
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.x ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug Error on Vercel: ``` 2021-10-28T15:40:49.826Z 94588f63-d2d6-4c45-9656-4763b8884447 ERROR Error: Cannot find module 'redux' Require stack: - /var/task/applications/studio/.next/server/pages/_app.js - /var/task/node_modules/next/dist/server/require.js - /var/task/node_modules/next/dist/server/load-components.js - /var/task/node_modules/next/dist/server/next-server.js - /var/task/applications/studio/___next_launcher.js - /var/runtime/UserFunction.js - /var/runtime/index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) at Function.Module._load (internal/modules/cjs/loader.js:745:27) at Module.require (internal/modules/cjs/loader.js:961:19) at require (internal/modules/cjs/helpers.js:92:18) at Object.6695 (/var/task/applications/studio/.next/server/pages/_app.js:517:18) at __webpack_require__ (/var/task/applications/studio/.next/server/webpack-runtime.js:25:42) at Object.3803 (/var/task/applications/studio/.next/server/chunks/803.js:30:23) at __webpack_require__ (/var/task/applications/studio/.next/server/webpack-runtime.js:25:42) at Object.3161 (/var/task/applications/studio/.next/server/pages/_app.js:71:13) at __webpack_require__ (/var/task/applications/studio/.next/server/webpack-runtime.js:25:42) { code: 'MODULE_NOT_FOUND', requireStack: [ '/var/task/applications/studio/.next/server/pages/_app.js', '/var/task/node_modules/next/dist/server/require.js', '/var/task/node_modules/next/dist/server/load-components.js', '/var/task/node_modules/next/dist/server/next-server.js', '/var/task/applications/studio/___next_launcher.js', '/var/runtime/UserFunction.js', '/var/runtime/index.js' ] } ``` But it is working on local machine. Then I try to move app to root, the Error is still: ``` 2021-10-28T16:35:44.673Z da6367a9-da39-40f5-93d9-5bd8af5714e1 ERROR Error: Cannot find module 'redux' Require stack: - /var/task/.next/server/pages/_app.js - /var/task/node_modules/next/dist/server/require.js - /var/task/node_modules/next/dist/server/load-components.js - /var/task/node_modules/next/dist/server/next-server.js - /var/task/___next_launcher.js - /var/runtime/UserFunction.js - /var/runtime/index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) at Function.Module._load (internal/modules/cjs/loader.js:745:27) at Module.require (internal/modules/cjs/loader.js:961:19) at require (internal/modules/cjs/helpers.js:92:18) at Object.6695 (/var/task/.next/server/pages/_app.js:517:18) at __webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42) at Object.6011 (/var/task/.next/server/chunks/11.js:30:23) at __webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42) at Object.5165 (/var/task/.next/server/pages/_app.js:71:13) at __webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42) { code: 'MODULE_NOT_FOUND', requireStack: [ '/var/task/.next/server/pages/_app.js', '/var/task/node_modules/next/dist/server/require.js', '/var/task/node_modules/next/dist/server/load-components.js', '/var/task/node_modules/next/dist/server/next-server.js', '/var/task/___next_launcher.js', '/var/runtime/UserFunction.js', '/var/runtime/index.js' ] } ``` ### Expected Behavior Should NOT output `Error: Cannot find module 'redux'` ### To Reproduce Deploy https://github.com/crossjs/cofe/tree/main on Vercel
https://github.com/vercel/next.js/issues/30561
https://github.com/vercel/next.js/pull/30637
f363cc8d44bb92d507fdd65a7963f4fd87f9c59d
599081acdffb05e9e28b7475ece2990db2714bf3
"2021-10-28T15:47:46Z"
javascript
"2021-10-29T22:39:51Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,547
["packages/next/build/webpack/loaders/next-middleware-ssr-loader/index.ts", "test/integration/react-rsc-basic/app/components/red/index.client.js", "test/integration/react-rsc-basic/app/components/red/style.module.css", "test/integration/react-rsc-basic/app/pages/_app.js", "test/integration/react-rsc-basic/app/pages/css-modules.server.js", "test/integration/react-rsc-basic/app/pages/global-styles-rsc.server.js", "test/integration/react-rsc-basic/app/pages/global-styles.js", "test/integration/react-rsc-basic/app/styles.css", "test/integration/react-rsc-basic/test/css.js", "test/integration/react-rsc-basic/test/index.test.js"]
Global styles with concurrent mode
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.17.4 ### What browser are you using? Chrome ### What operating system are you using? Windows ### How are you deploying your application? next dev ### Describe the Bug When creating a new next app with `create-next-app` and following the react alpha guide to enable server components, there seems to be some issue with the global CSS imports, which cause the app to crash at runtime since it tries to find an element with the id `__next_css__DO_NOT_USE__` which isn't there in the markup. This issue only occurs in development mode but works fine in the prod build since the CSS has been extracted to a separate file, and doesn't look for the style tag. ### Expected Behavior CSS imports should work as they work in the prod build and there should be a style element with the id `__next_css__DO_NOT_USE__` available in the markup in dev mode ### To Reproduce - Create a new next app with `npx create-next-app . --typescript --use-yarn` - Edit `next.config.js`: ```js module.exports = { experimental: { concurrentFeatures: true, serverComponents: true } } ``` - Add a `pages/_document.tsx` file: ```js import { Html, Head, Main, NextScript } from 'next/document' export default function Document() { return ( <Html> <Head /> <body> <Main /> <NextScript /> </body> </Html> ) } ``` - Start the app with `yarn dev`
https://github.com/vercel/next.js/issues/30547
https://github.com/vercel/next.js/pull/30639
c730f7312e563497e8769cecba54b6607a289e64
48874f1a443e41e7f5405086a9c3d6de9af3302b
"2021-10-28T12:48:54Z"
javascript
"2021-10-30T09:20:26Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,498
["packages/next/build/swc/Cargo.lock"]
Static pages render but React not mounting client-side in Production mode. Works in dev.
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 16.11.1 ### What browser are you using? Brave, Chrome, Safari ### What operating system are you using? macOS ### How are you deploying your application? next start ### Describe the Bug Prior to Next 12, building a production bundle and running the server via `next start` worked great. Most of my pages are static, and a handful are server-side-rendered. After upgrading, running `next dev` continues to work well but running `next build` followed by `next start` results in a non-interactive application. There are no build errors or warnings, and the app starts up fine. I can render my home page and even navigate via link in my menubar (next/links). All styles appear correct. However, none of the interactions powered by javascript are present. I added logging in the render function of my pages and I see the log statements when building the app (static pages) and in the server logs when hitting that route for server-side-rendered pages, but _none_ of the pages appear to mount the react application on the client. I don't see any logging, or can i interact with javascript-powered components (dropdown menus, etc). I do have a custom `_document.tsx` page in order to server-side render Material UI styles, and a custom `_app.tsx` page that adds things like Redux Providers, etc. I actually tried removing both of those pages and using the default Next pages, but I still was not able to get any log statements to print out in the browser from inside a render function. I do not have any custom babel configuration, nor any custom webpack configs. My various config files are below. I'm totally stumped by this. See the repo below to reproduce the issue. ### Expected Behavior The production build should behave exactly like the dev build, which should behave exactly like the test build. ### To Reproduce Edit: [here's a repo](https://github.com/neilpoulin/next-bugreport-30498) that reproduces the issue. While creating the repo, I learned a few things: * I'm pretty sure this issue is caused by pulling in a particular dependency, in this case `yup`. * The app behaves differently when building in Dev, Test, and Production modes (via `NODE_ENV=test|production|development`) * [dev] `next dev` -> app works as expected. No broken behavior, no build warnings, no console logs, everything is great. * [test] `NODE_ENV=test next build && NODE_ENV=test next start` -> app builds with no warnings/errors and all pages render, but there is no interaction available. The app doesn't seem to "mount". No errors in the browser or server. * [prod] `next build && next start` -> App builds fine, no warnings/errors. When loading the page in the browser content flashes, then a generic Next error screen appears: > Application error: a client-side exception has occurred (see the browser console for more information). Checking the browser console reveals a `ReferenceError: excludeEmptyString is not defined` ultimately coming from the `yup` library.
https://github.com/vercel/next.js/issues/30498
https://github.com/vercel/next.js/pull/31242
4299cc169c6552ffd54d02155a2efc0ebd355f68
fd9593542a52f7cd3ef4dbb6371893ef14dea2fa
"2021-10-28T01:00:44Z"
javascript
"2021-11-10T16:39:34Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,491
["docs/upgrading.md"]
WebSocket connection failed errors after upgrade to Next.js 12
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 12.22.3 ### What browser are you using? Brave ### What operating system are you using? macOS ### How are you deploying your application? next start ### Describe the Bug After upgrading to Next.js 12, I'm getting the following error while running the app in `dev` mode: ``` WebSocket connection to 'wss://app.name.dev/_next/webpack-hmr' failed: ``` We're using nginx to proxy the domain, so that we actually have a domain name, rather than just using localhost. I can't think of any other gotchas that might be contributing factors. The error repeats every few seconds, on a regular interval, and eventually floods the browser console. I am not seeing any errors printed to the terminal. ### Expected Behavior No errors! ### To Reproduce n/a
https://github.com/vercel/next.js/issues/30491
https://github.com/vercel/next.js/pull/30704
99abb8bfd7f662efb942763332b87f4348b8844d
900ec48c0344e230dbf696fdcb8f17be14c6b72d
"2021-10-27T21:48:58Z"
javascript
"2021-11-01T06:27:04Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,486
["packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts", "run-tests.js", "test/e2e/prerender-native-module.test.ts", "test/e2e/prerender.test.ts", "test/integration/jsconfig-baseurl/test/index.test.js", "test/integration/jsconfig-paths/test/index.test.js", "test/integration/production/test/index.test.js"]
Next.js 12 failing with `react-icons`
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug `next build` fails to bundle necessary files for `react-icons` ### Expected Behavior Should be able to run bundled functions from `nft.json` ### To Reproduce ```js // Put this in `pages/api/index.js` import { IconContext } from 'react-icons'; console.log(IconContext) export default function handler(req, res) { res.end('it works') } ``` Trace from `next build` is: ```json { "version": 1, "files": ["../webpack-runtime.js", "../../../package.json", "../../../node_modules/react-icons/lib/package.json", "../../../node_modules/react-icons/package.json", "../../../node_modules/react-icons/lib/cjs/index.js", "../../../node_modules/react/package.json", "../../../node_modules/react/index.js", "../../../node_modules/react-icons/lib/cjs/iconBase.js", "../../../node_modules/react-icons/lib/cjs/iconsManifest.js", "../../../node_modules/react-icons/lib/cjs/iconContext.js", "../../../node_modules/react/cjs/react.production.min.js", "../../../node_modules/object-assign/package.json", "../../../node_modules/object-assign/index.js" ] } ``` The trace from `nft` is: ``` node_modules/object-assign/index.js node_modules/object-assign/package.json node_modules/react-icons/index.js node_modules/react-icons/lib/cjs/iconBase.js node_modules/react-icons/lib/cjs/iconContext.js node_modules/react-icons/lib/cjs/iconsManifest.js node_modules/react-icons/lib/cjs/index.js node_modules/react-icons/lib/package.json node_modules/react-icons/package.json node_modules/react/cjs/react.development.js node_modules/react/cjs/react.production.min.js node_modules/react/index.js node_modules/react/package.json package.json pages/api/index.js pages/api/index.js ``` Notice the react-icons/index.js is missing from `next build` which causes the following: ``` Error: Cannot find module '/var/task/node_modules/react-icons/lib'. Please verify that the package.json has a valid "main" entry ```
https://github.com/vercel/next.js/issues/30486
https://github.com/vercel/next.js/pull/30985
5db9d09edd01ce5a95618ace828855e8b3e09324
bf097f1d0fdddd56644ea5a988aadcb1bbf025d2
"2021-10-27T20:58:05Z"
javascript
"2021-11-05T01:09:37Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,480
["packages/next/build/swc/Cargo.lock", "packages/next/build/swc/Cargo.toml", "packages/next/build/swc/src/bundle/mod.rs", "packages/next/build/swc/src/styled_jsx/transform_css.rs", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30480/input.js", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30480/output.js", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30570/input.js", "packages/next/build/swc/tests/fixture/styled-jsx/issue-30570/output.js", "packages/next/build/swc/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js"]
Interpolation in styled jsx media query not working after upgrading to nextjs 12
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 12.22.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug After upgrading to nextjs 12 interpolations in styled jsx media query not working anymore. ``` <style jsx>{`@media (${breakPoint}) {}`}</style> ``` is compiled to: `@media max-width: 1024px {}` but should be: `@media (max-width: 1024px) {}` The parenthesis is missing. ### Expected Behavior ``` <style jsx>{`@media (${breakPoint}) {}`}</style> ``` should be compiled to: `@media (max-width: 1024px) {}` ### To Reproduce 1. git clone https://github.com/dim2k2006/nextjs-styled-jsx-bug 2. yarn install 3. yarn dev 4. Open http://localhost:3000/ 5. Inspect page heading styles ![image](https://user-images.githubusercontent.com/7868088/139131165-06c635b1-3ae8-4f1b-8906-337cf1d3c0a8.png) Source code of the page could be found here: https://github.com/dim2k2006/nextjs-styled-jsx-bug/blob/main/pages/index.tsx
https://github.com/vercel/next.js/issues/30480
https://github.com/vercel/next.js/pull/31407
aaec9a93536b2535a8c8af94b707e91d3e596a9a
6fd44383f3df859da6f1381b41c588919a29ca82
"2021-10-27T19:11:33Z"
javascript
"2021-11-15T08:27:45Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,475
["packages/next/server/web/sandbox/polyfills.ts", "packages/next/server/web/sandbox/sandbox.ts"]
[middlewares] globalThis and globalThis.CryptoKey is missing
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? v14.18.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Both Vercel and `next dev` ### Describe the Bug Testing a universal JOSE (JWT/JWK/etc) library on Middlewares I've encountered an issue where the CryptoKey constructor is not exposed via globalThis.CryptoKey. This is the case for all browsers, Deno, and Cloudflare Workers runtimes but not for Middlewares deployed via vercel or running via `next dev`. Not having access to this constructor prohibits my particular library from validating user inputs. In `next dev` globalThis.CryptoKey is missing, **in vercel.com runtime `globalThis` is missing completely**. ### Expected Behavior `globalThis`, `globalThis.CryptoKey`, and `CryptoKey` are exposed both running via `next dev` or deployed via vercel.com ### To Reproduce Create a middleware like so, both in development as well as vercel.com, observe the failures are there and also, different. ```js export default async function middleware(req, ev) { try { if (typeof CryptoKey === 'undefined') { throw new Error('CryptoKey is missing') } if (typeof globalThis === 'undefined') { throw new Error('globalThis is missing') } if (!globalThis.CryptoKey) { throw new Error('globalThis.CryptoKey is missing') } return new Response(JSON.stringify({}), { status: 200 }); } catch (err) { return new Response(JSON.stringify({ error: err.stack }), { status: 400 }); } } ```
https://github.com/vercel/next.js/issues/30475
https://github.com/vercel/next.js/pull/31193
eb7b40171a4fcb1f913cad9ef35fa4e2f1a81177
0bcb7149dc7119e2e812c6e0aee89dc4213fc2c9
"2021-10-27T18:43:13Z"
javascript
"2021-11-09T17:39:29Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,456
["packages/next/build/webpack/loaders/next-swc-loader.js", "packages/next/taskfile.js", "test/integration/typescript/components/angle-bracket-type-assertions.ts", "test/integration/typescript/components/generics.ts", "test/integration/typescript/pages/angle-bracket-type-assertions.tsx", "test/integration/typescript/pages/generics.tsx", "test/integration/typescript/test/index.test.js"]
SWC Incorrect parsing of nested <> generics in fat arrow functions
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? v16.6.1 ### What browser are you using? Chrome ### What operating system are you using? Windows ### How are you deploying your application? Vercel ### Describe the Bug when updating the next from 11 to 12 it starts to have problem compiling generic parameters ### Expected Behavior Error: error: Unexpected token `<T>`. Expected jsx identifier ### To Reproduce create a simple class that receives something generic class MyClass`<T>` {};
https://github.com/vercel/next.js/issues/30456
https://github.com/vercel/next.js/pull/30619
d7d1a05208a7f929f2fab65dd76af0473d8bfff2
d8cb8c5fbcab02bba22e90407732a12e23e0d206
"2021-10-27T16:18:30Z"
javascript
"2021-10-30T12:51:42Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,430
["packages/next/server/next-server.ts", "packages/next/server/web/utils.ts", "test/integration/middleware-core/pages/responses/_middleware.js", "test/integration/middleware-core/pages/responses/deep/_middleware.js", "test/integration/middleware-core/pages/rewrites/_middleware.js", "test/integration/middleware-core/test/index.test.js", "test/unit/split-cookies-string.test.ts"]
Edge Functions: maxAge breaks Set-Cookie header
### What version of Next.js are you using? 12.0.0 ### What version of Node.js are you using? 16.3.0 ### What browser are you using? Chrome, Firefox ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug When using `_middleware.ts` and setting a cookie via `res.cookie(COOKIE_NAME, bucket, { maxAge: 10000 })`, the response contains two broken `Set-Cookie` headers instead of one correct one. Here is the response to the request in Chrome: ![image](https://user-images.githubusercontent.com/1765075/139059367-d483f6ca-2a01-46b5-a215-869d4a7bc8ff.png) Notice how the first `set-cookie` header abruptly stops after "Wed" and the content that would follow there then follows in a separate `Set-Cookie` header, except that the comma that should be after "Wed" is missing. <details> <summary>Response headers as text</summary> ``` set-cookie: bucket-marketing=original; Max-Age=10; Path=/; Expires=Wed set-cookie: 27 Oct 2021 11:43:14 GMT ``` </details> The value of `Set-Cookie` is originally something like `bucket-marketing=original; Max-Age=10; Path=/; Expires=Wed, 27 Oct 2021 11:43:14 GMT` and it seems as if the `,` splits the header into two. I tested, and this does not happen with other headers with the same value. This seems to be a regression. The same code is working in `^11.1.3-canary.104` but not in `12.0.0`. ### Expected Behavior Only one `Set-Cookie` header is added to the response. ### To Reproduce Clone the [Simple AB Testing example](https://edge-functions-ab-testing-simple.vercel.sh/) and adapt: ``` git clone [email protected]:vercel/examples.git ``` Update the next.js version to v12 by editing `examples/edge-functions/ab-testing-simple/package.json`: ```diff "dependencies": { - "next": "^11.1.3-canary.104" + "next": "12.0.0", }, ``` Run `yarn` in `examples/edge-functions/ab-testing-simple`. Then edit `examples/edge-functions/ab-testing-simple/pages/marketing/_middleware` to: ```ts import { NextRequest, NextResponse } from 'next/server' import { getBucket } from '@lib/ab-testing' import { MARKETING_BUCKETS } from '@lib/buckets' const COOKIE_NAME = 'bucket-marketing' export function middleware(req: NextRequest) { const bucket = req.cookies[COOKIE_NAME] || getBucket(MARKETING_BUCKETS) const res = NextResponse.rewrite(`/marketing/${bucket}`) // Removed the if-block to always set the cookie // Adding the maxAge option (this breaks the cookie) res.cookie(COOKIE_NAME, bucket, { maxAge: 10000 }) return res } ``` Run `yarn dev` to start Next.js. Open http://localhost:3000/marketing and inspect the response to the `marketing` site. You will see two `Set-Cookie` headers. This only happens when `maxAge` or `expires` are set in `res.cookie()`.
https://github.com/vercel/next.js/issues/30430
https://github.com/vercel/next.js/pull/30560
5b4ad4a1c1c97e38741df2d34c699828af9da254
450552ddbadd050b78d665448127c54b7e05c5fa
"2021-10-27T11:58:31Z"
javascript
"2021-10-28T17:46:58Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,421
["package.json", "packages/react-dev-overlay/package.json", "yarn.lock"]
Security Vulnerability on dependency [email protected] - CVE-2021-42740
### What version of Next.js are you using? latest ### What version of Node.js are you using? N/A ### What browser are you using? N/A ### What operating system are you using? N/A ### How are you deploying your application? N/A ### Describe the Bug A security vulnerability has been raised on one of next.js dependency [email protected] **Introduced through:** [email protected] › @next/[email protected][email protected] https://cve.report/CVE-2021-42740 latest version of shell-quote 1.7.3 fixes the issues : https://github.com/substack/node-shell-quote/blob/master/CHANGELOG.md#173 ### Expected Behavior N/A ### To Reproduce N/A
https://github.com/vercel/next.js/issues/30421
https://github.com/vercel/next.js/pull/30621
fb100ee72b028419e0eafc266ff83ff619114877
842a130218d180522a74bb136dcc637b48f8279e
"2021-10-27T10:01:19Z"
javascript
"2021-10-29T16:12:46Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,414
["packages/next/build/swc/Cargo.lock", "packages/next/build/swc/Cargo.toml", "packages/next/build/swc/src/transform.rs"]
swcMinify breaks CountUp package
### What version of Next.js are you using? 12.0.1 ### What version of Node.js are you using? 14.17.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? next start ### Describe the Bug When compiling with `swcMinify: true` it breaks [CountUp](https://www.npmjs.com/package/react-countup) react component and each number became as undefined ### Expected Behavior Working react component, without this feature works fine, but I want to use it ### To Reproduce 1. Install NextJS 2. Create config with swcMinify 3. Install [CountUp](https://www.npmjs.com/package/react-countup) package 4. Create any component and then build an app
https://github.com/vercel/next.js/issues/30414
https://github.com/vercel/next.js/pull/30790
7cd9ffc519c7b81f198dc6171c4c59418c5f15f3
e79f788f7437d9b87da09ff865c0135a141b25cc
"2021-10-27T08:01:08Z"
javascript
"2021-11-02T10:57:09Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,390
["packages/next/build/swc/src/styled_jsx/transform_css.rs", "packages/next/build/swc/tests/fixture/styled-jsx/global-child-selector/input.js", "packages/next/build/swc/tests/fixture/styled-jsx/global-child-selector/output.js"]
CSS Direct Child Selector with :global() no longer works in styled-jsx
### What version of Next.js are you using? 12.0.0 ### What version of Node.js are you using? v16.11.0 ### What browser are you using? Chrome ### What operating system are you using? Windows ### How are you deploying your application? Locally (next dev) ### Describe the Bug It seems like direct child CSS combinators (x > y) is not working, at least with the presence of `:global()` selectors. (See Repro for example) The output CSS will look like this: ```css .wm.jsx-XYZ *:not(.fullwidth):not(.wider) { /* ... */ } ``` rather than ">". ### Expected Behavior Output CSS will look like: ```css .wm.jsx-XYZ>*:not(.fullwidth):not(.wider) { /* ... */ } ``` which is what works in v11. ### To Reproduce Take CSS Like this: ```tsx const wmStyle = css.resolve` .wm > :global(*:not(.fullwidth):not(.wider)) { max-width: 5rem; `; const Component = () => ( <> <div className={wmStyle.className}> <div id="first"> <div id="second"></div> </div> </div> {wmStyle.styles} </> ); ``` The output CSS will look like this: ```css .wm.jsx-XYZ *:not(.fullwidth):not(.wider) { /* ... */ } ``` rather than ">".
https://github.com/vercel/next.js/issues/30390
https://github.com/vercel/next.js/pull/30771
2004d491987069c216d93c482108eefccad80d9a
5f72810dd6b9c02f3b31f8909b06ee6b80511166
"2021-10-27T01:25:11Z"
javascript
"2021-11-03T09:00:49Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,389
["packages/next-swc/Cargo.lock", "packages/next-swc/crates/core/Cargo.toml", "packages/next-swc/crates/core/tests/loader/issue-30389/input.js", "packages/next-swc/crates/core/tests/loader/issue-30389/output.js", "packages/next-swc/crates/core/tests/loader/issue-30766/input.js", "packages/next-swc/crates/core/tests/loader/issue-30766/output.js", "packages/next-swc/crates/napi/Cargo.toml", "packages/next-swc/crates/wasm/Cargo.toml"]
Nullish operator transpilation
### What version of Next.js are you using? 12 ### What version of Node.js are you using? 16 ### What browser are you using? chrome ### What operating system are you using? macOS ### How are you deploying your application? vercel/netlify ### Describe the Bug Nullish operator breaks pages, for example ```js const test = my_array?.[0] ?? []; ``` will produce ```js (my_array === null || my_array === void 0 ? void 0 : my_array[0]) ?? []; ``` ### Expected Behavior It should replace with `||` or what webpack / swc think is better ### To Reproduce Some api with ```js const test = my_array?.[0] ?? ''; ``` `next.config.js` ``` js experimental: { concurrentFeatures: false, serverComponents: false, swcMinify: false } ``` `next build`
https://github.com/vercel/next.js/issues/30389
https://github.com/vercel/next.js/pull/31816
b2acdbb788e48be4758f7555ae5fbe5ec5163eff
cfe561eae27e1eadb6372c8a90739ccc44092261
"2021-10-27T00:38:59Z"
javascript
"2021-11-26T09:01:30Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,377
["examples/with-storybook-styled-jsx-scss/.storybook/preview.js", "packages/next/client/index.tsx", "packages/next/package.json", "yarn.lock"]
styled-jsx is always included in client bundle (even when unused)
### What version of Next.js are you using? 12.0.0 ### What version of Node.js are you using? 16.6.2 ### What browser are you using? N/A ### What operating system are you using? macOS ### How are you deploying your application? N/A ### Describe the Bug Starting with nextjs 12.0.0 `styled-jsx` is included in the client bundle even when it’s not used anywhere in the project. e.g. in a fresh `create-next-app`: <img width="1237" alt="Screen Shot 2021-10-26 at 5 32 27 PM" src="https://user-images.githubusercontent.com/30265160/138964070-53754f8f-8064-4127-9fc8-7774ce277f65.png"> This wasn’t the case with Next.js 11. ### Expected Behavior `styled-jsx` should only be included in the bundle if it’s used in the project. ### To Reproduce Here’s a reproduction based on the latest `create-next-app` (with the `typescript` preset): https://github.com/GrantASL19/nextjs-12-unusued-styled-jsx-in-bundle It’s stock code with `WebpackBundleAnalyzer` set to run in the `next.config.js` webpack config.
https://github.com/vercel/next.js/issues/30377
https://github.com/vercel/next.js/pull/32730
b6fb52bbb04f4259b3a6528b7aeaa753c5f3b23f
ec3ca398cbd17a674fe0efe67a2763baf6490324
"2021-10-26T21:37:23Z"
javascript
"2021-12-22T13:38:27Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,376
["packages/next/build/webpack/loaders/next-swc-loader.js", "packages/next/taskfile.js", "test/integration/typescript/components/angle-bracket-type-assertions.ts", "test/integration/typescript/components/generics.ts", "test/integration/typescript/pages/angle-bracket-type-assertions.tsx", "test/integration/typescript/pages/generics.tsx", "test/integration/typescript/test/index.test.js"]
(12.0.0, SWC) TypeScript generics in objects incorrectly parsed as JSX
### What version of Next.js are you using? 12.0.0 ### What version of Node.js are you using? 14.18.1 ### What browser are you using? Chrome ### What operating system are you using? Linux ### How are you deploying your application? Vercel ### Describe the Bug Using the new SWC minifier on Next 12, objects that have functions with TypeScript generics seem to incorrectly be parsed as JSX. ### Expected Behavior TypeScript generics in objects with functions as keys should be correctly parsed ### To Reproduce Given the following code ```ts export const Client = { axios: Axios.create({ baseURL: "..." }), delete<T extends Object>(params: T) { return Client.axios.request(params); }, } ``` Results in the following error: ```sh Error: error: Expected a semicolon | 162 | delete<T extends Object>( | ^ error: Expected ',', got '< (jsx tag start)' | 162 | delete<T extends Object>( | ^ Caused by: 0: failed to process js file 1: Syntax Error ``` However, the following works OK ```ts export const Client = { delete: function<T extends Object>(params: T) { return Client.axios.request(params); }, } ```
https://github.com/vercel/next.js/issues/30376
https://github.com/vercel/next.js/pull/30619
d7d1a05208a7f929f2fab65dd76af0473d8bfff2
d8cb8c5fbcab02bba22e90407732a12e23e0d206
"2021-10-26T21:31:38Z"
javascript
"2021-10-30T12:51:42Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,375
["packages/next/server/response-cache.ts", "test/integration/data-fetching-errors/test/index.test.js"]
getStaticProps with revalidate silently swallowing errors
### What version of Next.js are you using? 12.0.0 ### What version of Node.js are you using? 16.13.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? next start ### Describe the Bug Starting with Next.js 11.1.0, any uncaught errors thrown by `getStaticProps` while running with `next start` are silently swallowed and not logged to the server output. ### Expected Behavior Up to Next.js 11.0.1, the same errors were logged to the server output. I don't see anything in the 11.1.0 release notes about this changing, and swallowing errors is generally not a good idea. ### To Reproduce Create a new project with `create-next-app`, put this in `pages/index.js` ```js export async function getStaticProps() { if (process.env.SIMULATE_ERROR) { console.log('[getStaticProps] throwing an error') throw new Error('Oops') } return { props: { title: 'Test Page' }, revalidate: 5, } } export default function Home({ title }) { return ( <div>{title}</div> ) } ``` Build with `npm run build`, start with `SIMULATE_ERROR=true npm start`, open the home page, wait 5 seconds and reload. With Next.js 11.0.1 this logs the following ``` [getStaticProps] throwing an error Error: Oops at getStaticProps (/Users/mirko/Projects/Next/new-app/.next/server/pages/index.js:22:11) at renderToHTML (/Users/mirko/Projects/Next/new-app/node_modules/next/dist/next-server/server/render.js:27:1786) ... ``` With Next.js 11.1.0 it just logs ``` [getStaticProps] throwing an error ``` but the uncaught error thrown by `getStaticProps` is nowhere to be seen.
https://github.com/vercel/next.js/issues/30375
https://github.com/vercel/next.js/pull/32657
2efc944cb9e2670c24deb089b1567f8002c417ae
626955d61c7d4d5e57c749cc2383fb5f8ad0b90d
"2021-10-26T21:21:38Z"
javascript
"2022-01-05T19:40:04Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,360
["packages/next/lib/typescript/writeConfigurationDefaults.ts", "test/integration/tsconfig-verifier/test/index.test.js"]
v12.0.0 -- Mono repo setups and extending tsconfigs break the build
### What version of Next.js are you using? 12 ### What version of Node.js are you using? 14.17.5 ### What browser are you using? Chrome ### What operating system are you using? mac, windows ### How are you deploying your application? Vercel ### Describe the Bug Next v12 has a function that, on dev or build, will look at the tsconfig and make suggestions. If you have a mono repo setup and the nearest tsconfig is not at the root of the repo, extending a tsconfig without the `incremental` config option will break the build. Check this repro repo out: https://github.com/akadop/next-v12-monorepo-bug ### Expected Behavior The `next` commands (dev, build, start) all work correctly as they have been with prior versions ### To Reproduce Check this repro repo out: https://github.com/akadop/next-v12-monorepo-bug To see this, just try running `yarn dev` without making any changes. You should see this error: ```` TypeError: Cannot set property 'incremental' of undefined at ~\v12-next-bug\node_modules\next\dist\lib\typescript\writeConfigurationDefaults.js:150:57) at async Object.verifyTypeScriptSetup (~\v12-next-bug\node_modules\next\dist\lib\verifyTypeScriptSetup.js:81:9) at async DevServer.prepare (~\v12-next-bug\node_modules\next\dist\server\dev\next-dev-server.js:262:9) ``` ```` If you go into the next.config and point the tsconfigPath at the nearest tsconfig, you get the same error. If you instead point it to the tsconfig at the root of the repo, the build has no issues
https://github.com/vercel/next.js/issues/30360
https://github.com/vercel/next.js/pull/30355
718003c8a725ad04da2c9f8e355cbe22cbc3d0be
431178bf531d8879679cd754ac0658d81a9b74a0
"2021-10-26T19:13:14Z"
javascript
"2021-10-27T04:11:07Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,353
["packages/next/server/web/spec-compliant/request.ts", "test/unit/web-runtime/request.test.ts"]
Accessing request.referrer in middleware errors instead of returning undefined when there's no referrer
### What version of Next.js are you using? 12.0.0 ### What version of Node.js are you using? 14.17.6 ### What browser are you using? Safari ### What operating system are you using? macOS ### How are you deploying your application? next dev ### Describe the Bug When attempting to access `request.referrer` in Next.js 12 middleware, if there is no referrer, an error occurs: ``` Error: Failed to get the 'referrer' property on 'Request': the property is not implemented ``` ### Expected Behavior Instead of an error, this should return an `undefined` or `null` value that can be used in middleware. ### To Reproduce Here's a contrived but simple example: ``` import { NextResponse } from 'next/server' const Middleware = ({ referrer }) => { if (!referrer || referrer !== 'birds.example.com') { return new Response(undefined, { status: 401, statusText: 'Go away! Birds only', }) } return NextResponse.next() } export default Middleware ```
https://github.com/vercel/next.js/issues/30353
https://github.com/vercel/next.js/pull/31343
66d9b4e14a2b59475480f24ad7c4a19d0f7d7eb7
b51a020941f79dccf818bad841bf377d6fd7bd1d
"2021-10-26T18:48:21Z"
javascript
"2021-11-15T19:52:44Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,300
["packages/next/export/worker.ts", "test/integration/export/test/index.test.js"]
404 page is exported to 404/index.html when trailingSlash is enabled
### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 16.12 ### What browser are you using? Firefox ### What operating system are you using? Ubuntu ### How are you deploying your application? next export ### Describe the Bug I don't remember the previous version, but it was working well before. When I updated the `next` version to **11.1.2**, `/about` exports as `/about.html`, that's why the doesn't work. Then I enabled **trailingSlash**, now the mentioned above case is solved but `404.tsx` is also exported as `404/index.html` which is not expected according to the static servers. ### Expected Behavior `404.tsx` should be exported as `/404.html` even when **trailingSlash** is enabled. ### To Reproduce N/A
https://github.com/vercel/next.js/issues/30300
https://github.com/vercel/next.js/pull/36827
d76bbde311da00cd750bf48d49887610960cafb9
093288c9d79a64411355c9c5e5db76d353cd8890
"2021-10-26T07:26:15Z"
javascript
"2022-05-11T18:44:25Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,279
["packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts", "test/integration/jsconfig-baseurl/test/index.test.js", "test/integration/jsconfig-paths/test/index.test.js"]
Latest canary breaks the @prisma/client module
### What version of Next.js are you using? 11.1.3-canary.100 ### What version of Node.js are you using? 14.x (vercel lts) ### What browser are you using? Chrome ### What operating system are you using? Windows ### How are you deploying your application? Vercel ### Describe the Bug In the latest canary, api handlers get the error `Error: Cannot find module '@prisma/client'`. I tested this using 11.1.3-canary.98 to 100 where the error occurs. I also tested 11.1.3-canary.97 where theres no error. just as an extra case i tested in 11.1.2 and there is no error so its an issue with one >=11.1.3-canary.98 canary versions. ### Expected Behavior The @prisma/client module should be able to be found ### To Reproduce Create an api handler that references @prisma/client and try and send a request, should respond with 500 internal server error and the log drain should so the module error. If needed i can provide my vercel deployment and access to the private repo where this issue occurs and i tested the 3 versions **Edit** I'm not completely sure if it is canary 98 that introduces the issue, I was going off of this as another of my websites uses the next-auth library as an api and it was on canary 97 and worked fine, on this i just tested 97 and it is also broken there however the only difference between this project using 97 and the other is that the file containing the prisma client instance is imported using src/lib/etc instead of ../../../lib/etc so it could be a module resolution thing similar to the old issue with apollo micro i do know that it is a problem with 11.1.3 as i tested this using 11.1.2 on the library that had all 4 canary version broken instead of just the 3 and it worked fine on 11.1.2 yep confirmed this isnt an issue with 98 just canary as a whole as i ran require("@prisma/client") in the same file as the api handler when i tested it using 11.1.2 it was definitely using the src/lib/etc path instead of ../../../ so its a module resolution issue with either swc or something introduced in canary
https://github.com/vercel/next.js/issues/30279
https://github.com/vercel/next.js/pull/30286
0910e8b8ca78738d659e4f9df96fb3fa9cef80e7
73fbd698bd94321544c1dce45784ab7f57263177
"2021-10-25T19:24:41Z"
javascript
"2021-10-25T23:38:30Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,239
["packages/next/build/webpack-config.ts", "packages/next/compiled/node-libs-browser/events.js", "packages/next/package.json", "yarn.lock"]
Events module not found after updating to 11.1.3-canary.82
### What version of Next.js are you using? 11.1.3-canary.82 ### What version of Node.js are you using? 14.17.5 ### What browser are you using? Chrome ### What operating system are you using? Windows ### How are you deploying your application? Vercel ### Describe the Bug I've been using a third party library which provides a react datagrid component and it has been working without any problems. However when I updated Next.js from `11.1.3-canary.81` to `11.1.3-canary.82` I started getting: ```js error - ./node_modules/@inovua/reactdatagrid-community/packages/react-virtual-list-pro/src/RowHeightManager.js:34:0 Module not found: Can't resolve 'events' Import trace for requested module: ./node_modules/@inovua/reactdatagrid-community/factory.js ./node_modules/@inovua/reactdatagrid-community/index.js ``` I believe this [commit](https://github.com/vercel/next.js/pull/30032) is directly related with this issue. I am aware of [Next.js documentation for such error](https://nextjs.org/docs/messages/module-not-found) but would like to know if this is something that should be forwarded to reactdatagrid authors, or if it is something unintentionally done in the commit mentioned above, due to the fact that it was working in previous Next.js versions. Thanks in advance. ### Expected Behavior No error should be thrown. ### To Reproduce Using Next.js >= 11.1.3-canary.82 and @inovua/reactdatagrid-community.
https://github.com/vercel/next.js/issues/30239
https://github.com/vercel/next.js/pull/30256
bc3ab3ce9446373b3ec1d558d4332eef9fad92e8
467bf08a8a7f14ddf043c7c0141889edfbb9f970
"2021-10-24T19:34:42Z"
javascript
"2021-10-25T13:32:01Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,236
["packages/next/build/webpack-config.ts", "packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts", "packages/next/server/config-shared.ts", "test/lib/next-test-utils.js"]
[12] An error occurs when running next build, requesting access to a other administrator account
### What version of Next.js are you using? - 11.1.3-canary.98 - 12.0.1 This does not occur in 11.1.2. ### What version of Node.js are you using? v14.15.4 ### What browser are you using? Not Related ### What operating system are you using? macOS ### How are you deploying your application? Not Related ### Describe the Bug I got a permission error when I ran `next build` (`outputFileTracing: true`). I am using a Mac provided by my company. My account does not have access to the company's account. `next build` tries to access the company's document when it runs. > pwd > /Users/me/nextTest > yarn run build > Source Maps > ~/_next/static/chunks/pages/404-43c9ab9dcbc3f86d.js.map > ~/_next/static/chunks/pages/500-5e6980db2f6004b0.js.map > ~/_next/static/chunks/pages/_app-4c4d8f09eb87746a.js.map > ~/_next/static/chunks/pages/_error-c3d0e4dd68006921.js.map > ~/_next/static/chunks/pages/test-82e1cc0eeb1f6afe.js.map > glob error [Error: EACCES: permission denied, scandir '/users/companyName/Documents'] { > errno: -13, > code: 'EACCES', > syscall: 'scandir', > path: '/users/companyName/Documents' > } > (node:10387) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, scandir '/users/companyName/Documents' > (Use `node --trace-warnings ...` to show where the warning was created) > (node:10387) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 23) > (node:10387) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. > (node:10387) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 23) > info - Creating an optimized production build > Failed to compile. > > Error: EACCES: permission denied, scandir '/users/companyName/Documents' > > > > Build failed because of webpack errors ### Expected Behavior No error. ### To Reproduce Create two administrator accounts and run next build under one of the accounts without giving each other access privileges.
https://github.com/vercel/next.js/issues/30236
https://github.com/vercel/next.js/pull/30857
95182480bf4ecbfdfd2794a9a1274f1635b7bcd3
5de4f668edb34273bc860055f37abfbab964cbb9
"2021-10-24T16:59:43Z"
javascript
"2021-11-04T09:23:28Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,231
["docs/advanced-features/debugging.md"]
Documentation for Windows Debugging
### Describe the feature you'd like to request When following the documentation for debugging with VS Code, Windows users will experience an error as environment variables cannot be set in the way currently described in the docs. ### Describe the solution you'd like Document using the `cross-env` package to enable cross-platform debugging ### Describe alternatives you've considered Using an alternative package to `cross-env`
https://github.com/vercel/next.js/issues/30231
https://github.com/vercel/next.js/pull/30052
3a9f008c9911baca48cb0fef991d597d5f2a7f03
39fcb8d338da23aca78a815829bf32708018b299
"2021-10-24T11:07:58Z"
javascript
"2021-10-28T10:59:31Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,220
["docs/02-app/01-building-your-application/05-optimizing/01-images.mdx"]
Add more data to docs on why image optimization is important
### Describe the feature you'd like to request The top of the Image Optimization page now has a list of next/image performance benefits, but it also might be helpful for folks to hear more specific data about the problem that it's trying to solve (i.e.why images are such a big contributor to perf issues on the web). ### Describe the solution you'd like Add stats to the Image Optimization intro like: - Unoptimized images account for over 70% of the total page weight in bytes at the 90th percentile. (https://almanac.httparchive.org/en/2020/page-weight#image-bytes) - The number of images on a page is the second greatest predictor of conversions of users visiting websites. (https://almanac.httparchive.org/en/2019/page-weight#bigger-complex-pages-can-be-bad-for-your-business) ### Describe alternatives you've considered There are a bunch more stats in the Web Almanac that could be interesting to cite.
https://github.com/vercel/next.js/issues/30220
https://github.com/vercel/next.js/pull/51066
1a0b5d25c60f98d87b7703c7d03eba260a9dcbf0
9fad474018e9f7710548fa0c054fb7b31da0511f
"2021-10-23T23:22:37Z"
javascript
"2023-06-09T22:02:35Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,219
["docs/api-reference/next/image.md", "docs/basic-features/image-optimization.md"]
Clarify in Image Optimization docs which width/height to use
### Describe the feature you'd like to request The current Image Optimization guide mentions that a width/height is mandatory when not using a static image or a "fill" layout, but doesn't specify which width/height to provide. The intrinsic size of the image or the size at which you'd like the image to be displayed? This confuses people because with a responsive strategy, you'd want to render the image at many different sizes depending on the device (so which width to provide?) ### Describe the solution you'd like Add a sentence or two to the "Image Sizing" requirements section that clarifies how to set width/height. ### Describe alternatives you've considered Could also add some explanation to the initial code example that includes width/height
https://github.com/vercel/next.js/issues/30219
https://github.com/vercel/next.js/pull/35188
9129bb9a054f36890d3138fd751c358b57534a07
bc460229ab5dc0aa7589c9e25b4581b60c014e9d
"2021-10-23T23:11:56Z"
javascript
"2022-03-17T19:16:15Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,203
["packages/next/server/next-server.ts", "packages/next/shared/lib/router/utils/prepare-destination.ts", "test/production/required-server-files-i18n.test.ts"]
For internationalised apps, asPath doesn't include dynamic param when rendering server side.
### What version of Next.js are you using? 11.1.2 and 11.1.3-canary.96 ### What version of Node.js are you using? 14.x ### What browser are you using? Chome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug I have a statically generated page with dynamic param like this `/pages/page/[slug].js`. It is using `getStaticProps` and using `getStaticPaths` to render some slugs and have `fallback: blocking`. I am using `asPath` from `useRouter()` to calculate canonical url for the page. But for the pages which are being rendered because of `fallback: blocking`, `asPath` is returning `/page/[slug]` instead of `/page/actual-slug`. As far as I can tell, it only happens in Vercel as `yarn start` works fine. **Fix** It starts returning actual slug if I remove i18n from `next.config.js`. So it has something to do with internationalisation ### Expected Behavior `asPath` should still return the actual slug value when i18n is present in `next.config.json` ### To Reproduce I have created a minimal reproduction repo. https://github.com/akshitkrnagpal/nextjs-error-repro You can verify by visiting these two urls https://nextjs-error-repro-sable.vercel.app/page/page-a - prebuilt https://nextjs-error-repro-sable.vercel.app/page/page-b - fallback blocking Do view source on both pages. For page-a, you'll see `<link rel="canonical" href="https://example.com/page/page-a"/>` For page-b, you'll see `<link rel="canonical" href="https://example.com/page/[slug]"/>`
https://github.com/vercel/next.js/issues/30203
https://github.com/vercel/next.js/pull/31281
6abc6699e9f93a7872a4f861f518671beebd9b2f
6b89fbf12d50f6ed7fc696d5ded48a52af98bca8
"2021-10-23T06:07:28Z"
javascript
"2021-11-11T20:11:50Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,198
["packages/create-next-app/helpers/is-folder-empty.ts"]
create-next-app is currently somewhat incompatible with yarn 2
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14.17.6 ### What browser are you using? Chrome ### What operating system are you using? Windows, Ubuntu ### How are you deploying your application? Vercel, but doesnt matter ### Describe the Bug ## Background Yarn is often used with nextjs projects and yarn has now just about fully transitioned to preferring yarn 2 rather than yarn classic. More and more yarn classic features are being deprecated, and as such, I think it would be important for yarn 2 to be even more compatible with nextjs. Currently, one of the pieces that is not super compatible is scaffolding an initial nextjs application using create-next-app. The current convention when using yarn to scaffold a new project is to use the `yarn create next-app` command. However, this will likely soon be deprecated in preference of using yarn's new cli command, `yarn dlx create-next-app`. Switching to using this instead of yarn create would be not only a better long term convention, but it would also make it so that a specific yarn classic package for supporting `yarn create` would no longer be necessary. This almost works, but not quite as for reasons stated below. ## Issue Using `yarn dlx` first requires a project to initialize yarn to use yarn 2 by running the command `yarn set version berry`, which creates 2 or 3 files depending on the OS including a .yarnrc.yml, package.json, and the .yarn directory with the subdirectory releases, which contains the current yarn release to be used with the project. If one then attempts to use `yarn dlx create-next-app`, it will fail with an exit code of 1 due to possibly conflicting files, particularly all 3 of the above mentioned files. The only workaround to this currently is to delete the package.json that it creates and then proceed to save the project in its own subdirectory of that yarn project, and then copy all of the files of that subdirectory that is created and hoist them into the parent directory. This isn't super conducive as I know many people like myself often create a project directory first and want to scaffold the project in that particular directory. ### Expected Behavior The expected behaviour would be for `yarn dlx create-next-app .`, much like `yarn dlx create-react-app .`, to either recognize the use of yarn 2 and ignore certain directory/file patterns in order to successfully scaffold an app or somehow otherwise be more compatible with yarn 2's `yarn dlx` equivalent of npx. Specifically this can probably be accomplished by ignoring the existence of .yarn/releases .yarnrc.yml and by either overwriting the package.json or adding to it. ### To Reproduce Update yarn to any 1.22.X version compatible with yarn 2, create a project directory and enter it, run `yarn set version berry` in terminal, and then run `yarn dlx create-next-app .`. It will most likely exit with an error code due to possible file conflicts.
https://github.com/vercel/next.js/issues/30198
https://github.com/vercel/next.js/pull/30936
4da09da1a2fa0c7b2d9c558b8072dfdd00a4b369
b30ae643a4faab8931a4b566277a615275a8ab39
"2021-10-23T03:07:41Z"
javascript
"2022-08-08T03:05:48Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,167
["packages/next/compiled/webpack/webpack.d.ts"]
next@canary - can't find module "webpack5"
### What version of Next.js are you using? canary ### What version of Node.js are you using? 16.11.1 ### What browser are you using? Brave ### What operating system are you using? Windows ### How are you deploying your application? NestJS / Express ### Describe the Bug next@canary can't find the module "webpack5" ``` [10:53:32] Starting compilation in watch mode... node_modules/next/dist/server/config-shared.d.ts:1:27 - error TS2307: Cannot find module 'webpack5' or its corresponding type declarations. 1 import type webpack5 from 'webpack5'; ~~~~~~~~~~ [10:53:37] Found 1 error. Watching for file changes. ``` ### Expected Behavior next@canary can find the module and compiles without issues ### To Reproduce Create a express app with nextjs and typescript. replace next with next@canary error should occour
https://github.com/vercel/next.js/issues/30167
https://github.com/vercel/next.js/pull/31206
a1e76fb96678b0ac3d7a74c28d2d005516ef1cc0
14aac0859f9630332651884cbdf648efee416fe2
"2021-10-22T09:00:28Z"
javascript
"2021-11-09T14:18:40Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,142
["docs/basic-features/eslint.md", "errors/manifest.json", "errors/no-head-element.md", "packages/eslint-plugin-next/lib/index.js", "packages/eslint-plugin-next/lib/rules/no-head-element.js", "test/unit/eslint-plugin-next/no-head-element.test.ts"]
document title deleted when using "priority" on Image component
### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 14.17.1 ### What browser are you using? Chrome ### What operating system are you using? Linux 5.4.0-89-generic #100-Ubuntu ### How are you deploying your application? Vercel ### Describe the Bug Document title deleted after adding "priority" prop to a <Image /> component. ### Expected Behavior The title would not be deleted by any <Image /> related configuration. ### To Reproduce Working document title on _app.js: ``` function MyApp({ Component, pageProps }) { return ( <div> <title>Generic title</title> <Component {...pageProps} /> <div/> ); } export default MyApp; ``` But, as soon as I add "priority " to my image in exampleSection.js, like so: `<Image alt="Background" src={background} placeholder="blur" quality="100" layout="fill" priority objectFit="cover" className={style.backgroundImage} />` The title on html inspection got deleted, even though it is on the page source. The way I fixed it: ``` import Head from 'next/head' function MyApp({ Component, pageProps }) { return ( <div> <Head> <title> Generic title </title> </Head> <Component {...pageProps} /> <div/> ); } export default MyApp; ```
https://github.com/vercel/next.js/issues/30142
https://github.com/vercel/next.js/pull/32897
636d3aeda753301657cf9f2e9faa8e947392bfe2
d72f5bd69dcd243645ce43722cd86db030b94e1e
"2021-10-21T14:42:51Z"
javascript
"2021-12-31T05:09:44Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,078
["packages/next/build/webpack-config.ts", "test/integration/build-output/test/index.test.js"]
Node.js v17.0.0 - Error starting project in development mode
### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 17.0.0 ### What browser are you using? Chrome 94.0.4606.81 ### What operating system are you using? Windows 10 ### How are you deploying your application? / ### Describe the Bug After updating Node.js to the new version, when starting the project in development mode, the following error is obtained in the terminal. ```sh > [email protected] dev > next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at BulkUpdateDecorator.hashFactory (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18) at BulkUpdateDecorator.update (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50) at OriginalSource.updateHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264) at NormalModule._initBuildHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17) at handleParseResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10) at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4 at processResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11) at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at BulkUpdateDecorator.hashFactory (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18) at BulkUpdateDecorator.update (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50) at OriginalSource.updateHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264) at NormalModule._initBuildHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17) at handleParseResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10) at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4 at processResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11) at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5 node:internal/crypto/hash:67 this[kHandle] = new _Hash(algorithm, xofLen); ^ Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at BulkUpdateDecorator.hashFactory (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18) at BulkUpdateDecorator.update (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50) at OriginalSource.updateHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264) at NormalModule._initBuildHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17) at handleParseResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10) at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4 at processResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11) at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5 { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' } Node.js v17.0.0 ``` ### Expected Behavior The project is expected to be launched successfully. ### To Reproduce Update Node.js version to 17.0.0, create a new Next.js app using `create-next-app` and start Next.js in development mode.
https://github.com/vercel/next.js/issues/30078
https://github.com/vercel/next.js/pull/30095
3b34626fc879364312a625e642f423c673ace82c
610d2b37c86adb10dc15e8644c096fecd15f733b
"2021-10-19T20:47:07Z"
javascript
"2021-10-20T21:39:55Z"
closed
vercel/next.js
https://github.com/vercel/next.js
30,054
["examples/with-semantic-ui/.nowignore", "examples/with-semantic-ui/next.config.js", "examples/with-semantic-ui/package.json", "examples/with-semantic-ui/pages/SmallImage.png", "examples/with-semantic-ui/pages/_app.js", "examples/with-semantic-ui/pages/index.js", "examples/with-semantic-ui/public/image.png", "examples/with-semantic-ui/styles/global.css"]
webpack5 not working in with-semantic-ui example
### What example does this report relate to? with-semantic-ui ### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? v14.17.5 ### What browser are you using? Chrome ### What operating system are you using? Linux ### How are you deploying your application? next start ### Describe the Bug when I update next and start application: I see error in console: error - ./pages/LargeImage.png TypeError: unsupported file type: undefined (file: undefined) error - ./pages/LargeImage.png TypeError: unsupported file type: undefined (file: undefined) I have tried ```javascript module.exports = { webpack(config) { config.module.rules.push({ test: /\.png/, type: 'asset/resource' } ) return config }, } ``` There is no "unsupported file type error", but images not loading (404 not found ) ### Expected Behavior Imported images should load without errors ### To Reproduce ```bash npx create-next-app --example with-semantic-ui with-semantic-ui-app cd with-semantic-ui-app/ npm i next@latest npm run dev ```
https://github.com/vercel/next.js/issues/30054
https://github.com/vercel/next.js/pull/32805
6b866533cd7276e00ceed0710a152a36c1a86f63
22655a1aabaaa102fbdef8bc2ace23a2ff41362f
"2021-10-19T03:57:42Z"
javascript
"2021-12-24T23:07:30Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,926
["packages/next/cli/next-lint.ts", "test/integration/eslint/test/index.test.js"]
Eslint's --cache-strategy argument is not supported
### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 14.16.1 ### What browser are you using? Chrome ### What operating system are you using? Windows 10 ### How are you deploying your application? next start ### Describe the Bug `--cache-strategy` is an argument introduced in ESLint [v7.21.0](https://github.com/eslint/eslint/commit/08ae31e539e381cd0eabf6393fa5c20f1d59125f), which can be set to either `content` or `metadata`. Before its addition, the default behavior was metadata, which doesn't help in CI context where the repository is cloned every time (the modification date of all the files are is to the clone time). Using the `content` value for the argument, we can have an ESLint cache that works in CI. Unfortunately, next doesn't support this argument yet, ie we can't pass it down to ESLint through `next lint`. ### Expected Behavior No error when using `--cache-strategy` argument ### To Reproduce Run in project root: ``` > yarn run next lint --cache --cache-strategy content --cache-location .cicache/eslint/.cache.json ``` Output: ``` yarn run v1.22.10 $ Path\to\project\node_modules\.bin\next lint --cache --cache-strategy content --cache-location .cicache/eslint/.cache.json Unknown or unexpected option: --cache-strategy error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ```
https://github.com/vercel/next.js/issues/29926
https://github.com/vercel/next.js/pull/29928
ca41952d1433dbc9cbc5f5ded9f189ea1d3b1c06
39ef77cbe644f66060efddd45b88ee83fa5bc3fd
"2021-10-14T21:36:10Z"
javascript
"2021-11-08T17:17:42Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,925
["packages/next/build/index.ts", "packages/next/build/utils.ts", "test/integration/critical-css/components/hello.js", "test/integration/critical-css/components/hello.module.css", "test/integration/critical-css/pages/another.js", "test/integration/critical-css/pages/index.js", "test/integration/critical-css/test/index.test.js"]
Experimental OptimizeCss flag (critters) isn't deferring all css files properly.
### What version of Next.js are you using? 11.1.3-canary.0 ### What version of Node.js are you using? 16.1.0 ### What browser are you using? chrome (shouldn't matter, the html is what's different) ### What operating system are you using? Windows (I think this could have to do with it) ### How are you deploying your application? Vercel! ### Describe the Bug I'm experimenting by using the new optmizeCss experimental property in the next.config.js (and it's sorta awesome for FCP). Locally, I was able to get my FCP to be the same as TTFB. Hats off to you all! So locally it works great, but when I deploy to vercel I don't have the same thing happen. Unfortunately, several of my CSS resources aren't properly defered and end up being render blocking (in a way that's worse than having the optimizeCss flag off). Locally (npm run build/npm start) (next build/next start), the output HTML of my application has the defers CSS loading properly like so... ``` <link rel="stylesheet" href="/mfe/pdp/_next/static/css/c6011bfa7bebf07f295b.css" data-n-g="" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/c6011bfa7bebf07f295b.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/34299f6482a8336ff401.css" data-n-p="" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/34299f6482a8336ff401.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/4f17191406a61c110eda.css" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/4f17191406a61c110eda.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/0c5bcc4e2145116a961a.css" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/0c5bcc4e2145116a961a.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/ba51bed5c56d6db12683.css" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/ba51bed5c56d6db12683.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/968ed11759396a8e89e7.css" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/968ed11759396a8e89e7.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/dbf9f1ea1a43e865f4fa.css" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/dbf9f1ea1a43e865f4fa.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/90228b002c6938abeaf2.css" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/90228b002c6938abeaf2.css"> </noscript><noscript data-n-css=""></noscript> ``` On Vercel, I'm seeing this (some files deferred where as some are not) ``` <link rel="stylesheet" href="/mfe/pdp/_next/static/css/c6011bfa7bebf07f295b.css" data-n-g="" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/c6011bfa7bebf07f295b.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/34299f6482a8336ff401.css" data-n-p="" media="print" onload="this.media='all'"><noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/34299f6482a8336ff401.css"> </noscript> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/4f17191406a61c110eda.css"> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/0c5bcc4e2145116a961a.css"> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/ba51bed5c56d6db12683.css"> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/968ed11759396a8e89e7.css"> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/dbf9f1ea1a43e865f4fa.css"> <link rel="stylesheet" href="/mfe/pdp/_next/static/css/90228b002c6938abeaf2.css"> ``` You can see the last bunch of stylesheets starting with 4f17191406a61c110eda.css aren't properly deferred. ### Expected Behavior The output HTML document from vercel would match the one on localhost. IE: the deferred link tags (which work locally) would be the same when hosted on vercel. ### To Reproduce I'm not able to get a minimal repro going for this unfortunately as I don't know quite what is triggering things. I'm happy to communicate about the characteristics of our repository/set up that might be leading to this. A couple of notable things... - We use styled components, however I'm quite sure that we're always using internal CSS for those - We use next/dynamic quite a bit - The files that are not being deferred are all css (sass) modules (we use the sass npm module), but that's also true for the ones that are deferred - Some of the styles come from an npm package (a design library) that is being transpiled using next-transpile-modules, but the files that do/don't have the issue are a mixture (similar to the above point) Here's a network capture... you'll notice that the size doesn't seem to be a factor (of course I don't know too much about the internals of critters) ![image](https://user-images.githubusercontent.com/7562533/137395573-be499b28-d4b4-42bb-974f-dbdbf18e8f60.png)
https://github.com/vercel/next.js/issues/29925
https://github.com/vercel/next.js/pull/33752
c2b6d235f2635ae8ea4fa8519f64bcc70830f40d
7ec49be7ac4657775483958755e10a9435e8171a
"2021-10-14T21:09:21Z"
javascript
"2022-01-27T22:22:20Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,788
["packages/next/client/image.tsx", "packages/next/image-types/global.d.ts", "packages/next/tsconfig.json"]
Cannot find name 'StaticImageData'.
### What version of Next.js are you using? 11.1.2 & 11.1.3-canary.57 ### What version of Node.js are you using? 14.16.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? next build ### Describe the Bug The following error occurs during type checking. ```bash node_modules/next/dist/client/image.d.ts:19:14 - error TS2304: Cannot find name 'StaticImageData'. 19 default: StaticImageData; ~~~~~~~~~~~~~~~ node_modules/next/dist/client/image.d.ts:21:45 - error TS2304: Cannot find name 'StaticImageData'. 21 declare type StaticImport = StaticRequire | StaticImageData; ``` I got the following Issue in v11.0.0, upgraded to v11.1.2 and the problem was solved, but now I get this error instead. https://github.com/vercel/next.js/issues/26892 ### Expected Behavior TS compiler should not give errors. ### To Reproduce Here's the full code to my component: ```js import { memo, useState, VFC } from 'react'; import Image, { ImageProps } from 'next/image'; import { isTest } from 'src/lib/environmentDetector'; type PropsType = ImageProps & { fallback: string | JSX.Element; }; export const ImageWithFallback: VFC<PropsType> = memo( ({ src, fallback, ...rest }) => { const [showFallback, setShowFallback] = useState(false); if (isTest()) return null; const onError = () => { setShowFallback(true); }; if (showFallback && typeof fallback !== 'string') return fallback; return <Image {...rest} src={showFallback ? (fallback as string) : src} onError={onError} />; }, (p, n) => p.src === n.src ); ```
https://github.com/vercel/next.js/issues/29788
https://github.com/vercel/next.js/pull/34394
4613e3be629d8fb44581aa3492560cbf3f2c9c9f
27affb414159bea10cca57b1291fe7037ee90bdb
"2021-10-11T01:38:34Z"
javascript
"2022-02-19T03:25:49Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,770
["packages/create-next-app/create-app.ts"]
`yarn create next-app --ts` sets wrong eslint version
### What example does this report relate to? yarn create next-app --typescript ### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 16.10.0 ### What browser are you using? chrome 94 ### What operating system are you using? Arch Linux ### How are you deploying your application? N/A ### Describe the Bug When creating a next.js project using `yarn create next-app --typescript`, eslint version of the project is set to `8.0.0` in `package.json`, however `eslint-config-next` depends on eslint `^7.23.0`. When running `yarn lint`, it errors: ``` yarn run v1.22.15 $ next lint info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 error - ESLint must be installed: yarn add --dev eslint Done in 0.86s. ``` When creating a next.js using `npx create-next-app@latest --ts`, the eslint version is set correctly. I didn't test the non-ts version. ### Expected Behavior eslint version of the project should be `^7.23.0` ### To Reproduce ``` yarn create next-app --typescript cd project_name yarn lint ```
https://github.com/vercel/next.js/issues/29770
https://github.com/vercel/next.js/pull/29837
7b3cce3f94ef88379f037bf02975996d3cbebaed
c78d8fad19e70a71fe9975984bf6f59e3bfb27bb
"2021-10-10T03:32:39Z"
javascript
"2021-10-12T16:02:55Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,744
["docs/api-reference/next/image.md", "packages/next/server/config.ts", "test/integration/image-optimizer/test/index.test.js"]
Configuring `next.config.js` with images.loader should error if missing images.path
When a user configures `next.config.js` with the `images.loader` prop such as `cloudinary`, next should error if the `images.path` property is missing. The error message should guide the user to the correct value. https://nextjs.org/docs/api-reference/next/image#loader-configuration
https://github.com/vercel/next.js/issues/29744
https://github.com/vercel/next.js/pull/30080
6f3dc0162f7da1058c33c5d57eb87e01f5f62372
f2cf092ee6a18574e49b0984c5f13d1ee9a84e65
"2021-10-08T15:11:16Z"
javascript
"2021-10-20T00:17:24Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,717
["docs/api-reference/next/image.md", "docs/basic-features/image-optimization.md", "packages/next/client/image.tsx", "test/integration/image-component/default/pages/inside-paragraph.js", "test/integration/image-component/default/test/index.test.js"]
<Image> components in <p> tags act oddly
### What version of Next.js are you using? 11.x ### What version of Node.js are you using? 14.15.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? n/a ### Describe the Bug Because `<Image>` uses a `<div>` wrapper under the hood, adding an `<Image>` tag within a `<p>` tag results in a `<div>` inside a `<p>` (which is considered a semantic malformation in HTML). In attempting to handle the malformation, the browser starts with the `<div>` outside the `<p>`, then eventually appends it correctly. This churn causes CLS as a line break is briefly visible. ### Expected Behavior There shouldn't be a line break. One potential fix is to replace the wrapper `<div>` with a `<span>`, which would be semantically valid. This would be a breaking change. ### To Reproduce See repro here: https://github.com/goncy/nextjs-image-bug-repro
https://github.com/vercel/next.js/issues/29717
https://github.com/vercel/next.js/pull/30041
0daaae32dc01494c408afc54eb19c01d2d8bfdf2
1a0c1e8a5b47e49602e058a0d3e254fa885a61c4
"2021-10-07T19:17:55Z"
javascript
"2021-10-18T21:29:19Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,667
["packages/next/build/babel/plugins/no-anonymous-default-export.ts"]
Warning: `Anonymous arrow functions cause Fast Refresh to not preserve local component state.` often has wrong output path
### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 16.10.0 ### What browser are you using? doesn't matter ### What operating system are you using? Ubuntu 21.04 ### How are you deploying your application? doesn't matter ### Describe the Bug It shows the same warning very often: `Anonymous arrow functions cause Fast Refresh to not preserve local component state.` The printed path is 3 times `./src/A.tsx` even though the problem is in `A.tsx`, `B.tsx` and `C.tsx` ``` > [email protected] dev > next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 warn - ./src/A.tsx Anonymous arrow functions cause Fast Refresh to not preserve local component state. Please add a name to your function, for example: Before export default () => <div />; After const Named = () => <div />; export default Named; A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc ./src/A.tsx Anonymous arrow functions cause Fast Refresh to not preserve local component state. Please add a name to your function, for example: Before export default () => <div />; After const Named = () => <div />; export default Named; A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc ./src/A.tsx Anonymous arrow functions cause Fast Refresh to not preserve local component state. Please add a name to your function, for example: Before export default () => <div />; After const Named = () => <div />; export default Named; A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc info - ready on http://localhost:3000 event - build page: /next/dist/pages/_error wait - compiling... warn - ./src/A.tsx Anonymous arrow functions cause Fast Refresh to not preserve local component state. Please add a name to your function, for example: Before export default () => <div />; After const Named = () => <div />; export default Named; A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc ./src/A.tsx Anonymous arrow functions cause Fast Refresh to not preserve local component state. Please add a name to your function, for example: Before export default () => <div />; After const Named = () => <div />; export default Named; A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc ./src/A.tsx Anonymous arrow functions cause Fast Refresh to not preserve local component state. Please add a name to your function, for example: Before export default () => <div />; After const Named = () => <div />; export default Named; A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc info - ready on http://localhost:3000 ``` ### Expected Behavior It shows the warning at most 1 time per file ### To Reproduce See https://github.com/SimonSiefke/nextjs-bug-2
https://github.com/vercel/next.js/issues/29667
https://github.com/vercel/next.js/pull/31322
e5171758d3b72b90269225e6f3b371a3b2bcc0cb
8c547139e4250a8e99e2c093a498cce2d6e921cf
"2021-10-06T13:19:16Z"
javascript
"2021-11-15T14:01:20Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,624
["docs/basic-features/image-optimization.md"]
Explain "priority" attribute in "Image Optimization" guide
### Describe the feature you'd like to request We recently got feedback from a partner that it wasn't clear that LCP images needed to use the "priority" attribute of next/image. This requirement is buried in the API ref and not easy for first-time users of next/image to find. ### Describe the solution you'd like We should add a more obvious section to the "Image optimization" guide about how to treat LCP images, with an example that uses the "priority" attribute (with a caveat that it should be used sparingly). ### Describe alternatives you've considered We could also just add the "priority" attribute to one of the first examples, but we should also explain when it's appropriate to use it (so folks don't add it where it's not needed)
https://github.com/vercel/next.js/issues/29624
https://github.com/vercel/next.js/pull/30218
f5b7baca53d0be346d58838ca402ec6cb544c4e1
2fe5d011e624fdc9f623222a152f7b15d3fbe3c1
"2021-10-04T22:55:55Z"
javascript
"2021-10-25T21:04:00Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,597
["docs/advanced-features/using-mdx.md", "docs/manifest.json"]
Add MDX section to Advance features
### Describe the feature you'd like to request We don't currently offer much in the way of MDX docs. There are now a number of different MDX solutions one could use with Next.js. We should document them. ### Describe the solution you'd like Add a new section to the Advanced features section which outlines how to use each of the MDX packages with Next.js ### Describe alternatives you've considered N/A
https://github.com/vercel/next.js/issues/29597
https://github.com/vercel/next.js/pull/30869
d9712626036f7615677da89f2b51258d6a33e994
91e86203764746182fb0b44d6f491817193d65ab
"2021-10-04T08:24:54Z"
javascript
"2021-11-22T17:27:43Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,593
["docs/api-reference/create-next-app.md", "docs/basic-features/typescript.md", "docs/getting-started.md", "docs/testing.md"]
`npx create-next-app --ts` doesn't add TS
### What version of Next.js are you using? N/A ### What version of Node.js are you using? 14.17.6 ### What browser are you using? N/A ### What operating system are you using? N/A ### How are you deploying your application? N/A ### Describe the Bug As per https://nextjs.org/docs/basic-features/typescript, `npx create-next-app --ts` should help me get started with Next.js + TypeScript... but it doesn't: ``` ▲ (pear-vm) npx create-next-app --ts ✔ What is your project named? … testing Creating a new Next.js app in /home/matheus/dev/personal/testing. Installing react, react-dom, and next using yarn... yarn add v1.22.5 info No lockfile found. [1/4] Resolving packages... [...] Done in 4.79s. Initialized a git repository. Success! Created testing at /home/matheus/dev/personal/testing Inside that directory, you can run several commands: yarn dev Starts the development server. yarn build Builds the app for production. yarn start Runs the built app in production mode. We suggest that you begin by typing: cd testing yarn dev A new version of `create-next-app` is available! You can update by running: yarn global add create-next-app ▲ (pear-vm) ls -lah testing total 132K drwxrwxr-x 7 matheus matheus 4.0K Oct 4 03:11 . drwxrwxr-x 34 matheus matheus 4.0K Oct 4 03:11 .. drwxrwxr-x 8 matheus matheus 4.0K Oct 4 03:11 .git -rw-r--r-- 1 matheus matheus 386 Aug 29 16:35 .gitignore drwxrwxr-x 228 matheus matheus 12K Oct 4 03:11 node_modules -rw-rw-r-- 1 matheus matheus 257 Oct 4 03:11 package.json drwxrwxr-x 3 matheus matheus 4.0K Oct 4 03:11 pages drwxrwxr-x 2 matheus matheus 4.0K Oct 4 03:11 public -rw-r--r-- 1 matheus matheus 1.6K Aug 29 16:35 README.md drwxrwxr-x 2 matheus matheus 4.0K Oct 4 03:11 styles -rw-rw-r-- 1 matheus matheus 84K Oct 4 03:11 yarn.lock ▲ (pear-vm) personal {sfo1} cat testing/package.json { "name": "testing", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start" }, "dependencies": { "next": "11.1.2", "react": "17.0.2", "react-dom": "17.0.2" } } ``` ### Expected Behavior `npx create-next-app --ts` should create a Next.js app with TypeScript ### To Reproduce Run `npx create-next-app --ts`
https://github.com/vercel/next.js/issues/29593
https://github.com/vercel/next.js/pull/29595
a9ad8cbbd92ba73ae13e4b28d9851f3e240f960a
9581658b8aa82bb9143f48ac12d820f64d2ebf8f
"2021-10-04T03:15:20Z"
javascript
"2021-10-04T09:13:45Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,553
["packages/next/build/webpack-config.ts", "test/integration/externals-esm-loose/node_modules/preact/compat.js", "test/integration/externals-esm/node_modules/preact/compat.js", "test/integration/externals/node_modules/preact/compat.js"]
Broken Webpack's "resolve.alias" (Next 11.1.3-canary.41)
### What version of Next.js are you using? 11.1.3-canary.41 ### What version of Node.js are you using? 14.18.0 ### What browser are you using? Chrome ### What operating system are you using? Windows 10 ### How are you deploying your application? next start ### Describe the Bug Hi there. It seems like webpack's `resolve.alias` in webpack config is not behaving correctly in the last canary releases. When trying to create a conditional resolution, for example: ```ts webpack: (config, {isServer}) => { config.resolve = { ...config.resolve, alias: { ...config.resolve.alias, parse: isServer ? "parse/node" : "parse" } }; return config; }; ``` It still keeps the "parse" imports, resulting in errors during SSR page compilation related to missing browser APIs. (localStorage in this case). This is only the case in canary, and works fine in the lastest. ### Expected Behavior Resolve all imports during SSR stage to the specified module. ### To Reproduce 1. Clone https://github.com/thecynicalpaul/broken-next-alias 2. `npm i` 3. `npm run build`
https://github.com/vercel/next.js/issues/29553
https://github.com/vercel/next.js/pull/29611
92c2dd4971c8ff04ecdc0ad5948a58c95391376c
15822516e7b20cbd968d9a7a63989b6ecbbe09d6
"2021-10-01T19:37:15Z"
javascript
"2021-10-04T23:57:27Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,479
["docs/getting-started.md"]
Refactor and make clearer, getting started guide
### Describe the feature you'd like to request Currently the getting started guide outlines 2 types of setup, using `create next-app` and manually installing `next react react-dom`. While the first step is relatively clear, the manual setup doesn't give clear instructions and assumes the user knows how to setup the file structure ### Describe the solution you'd like Add clearer steps for the manual setup ### Describe alternatives you've considered N/A
https://github.com/vercel/next.js/issues/29479
https://github.com/vercel/next.js/pull/35898
e146168c3bf2056c6e722a949bf67c0affeac118
5429e8f12e7bf54177ba68eafd65160017b90cde
"2021-09-29T07:10:36Z"
javascript
"2022-04-06T13:06:50Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,363
["packages/next/client/image.tsx", "test/integration/image-component/default/pages/on-loading-complete.js", "test/integration/image-component/default/test/index.test.js"]
OnLoadingComplete not working when passing function, but works when console log
### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 10.20.1 ### What browser are you using? chrome ### What operating system are you using? codesandbox ### How are you deploying your application? codesandbox ### Describe the Bug I'm trying to get the naturalWidth and naturalHeight from onLoadingComplete props: https://nextjs.org/docs/api-reference/next/image#onloadingcomplete but its not working? Perhaps I'm doing it wrong? I have a codesandbox, lines 62, 63: https://codesandbox.io/s/proud-rain-d51sv?file=/pages/index.js When you upload an image, console log only works, but it doesn't work when I'm trying to pass handleImageLoad function listed in the sandbox. ### Expected Behavior Trying to get naturalWidth and naturalHeight ### To Reproduce https://codesandbox.io/s/proud-rain-d51sv?file=/pages/index.js lines 62, 63
https://github.com/vercel/next.js/issues/29363
https://github.com/vercel/next.js/pull/29367
f0eb9283f08d4566aeece2597e3beb87854e4f8e
2271cd841d9840b703f57fb8d791b4e3b373430d
"2021-09-24T17:21:23Z"
javascript
"2021-09-26T15:03:07Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,310
["examples/cms-strapi/components/cover-image.js"]
Clicking on cover image redirects to an undefined page
### What example does this report relate to? cms-strapi ### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 14.17.5 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug clicking on the cover image of a post redirects to `site.com/posts/undefined` The ternary operators used incorrectly ```jsx return ( <div className="-mx-5 sm:mx-0"> <Link href={`/blog/${slug}`}> {slug ? <a aria-label={title}>{image}</a> : image} </Link> </div> ); ``` ### Expected Behavior when the cover image of the post is clicked (in `[slug.js]`), it should not redirect to a page ### To Reproduce Go to any created post and click on the cover image ![image](https://user-images.githubusercontent.com/63289278/134431682-ea91dcff-3744-4f86-8eb9-2ca05e3af199.png)
https://github.com/vercel/next.js/issues/29310
https://github.com/vercel/next.js/pull/29311
0d4e4e90924a14ce3e24e8eed88dbd9a4b2bb2fc
797dca5913446c15ea7787f05ec3cf8b27edb845
"2021-09-22T22:43:51Z"
javascript
"2021-09-22T23:07:12Z"
closed
vercel/next.js
https://github.com/vercel/next.js
29,289
["packages/next/build/webpack/loaders/next-image-loader.js", "packages/next/server/config.ts", "packages/next/server/image-optimizer.ts", "test/integration/image-component/base-path/components/TallImage.js", "test/integration/image-component/base-path/components/tall.png", "test/integration/image-component/base-path/pages/static-img.js", "test/integration/image-component/base-path/public/foo/test-rect.jpg", "test/integration/image-component/base-path/public/test.ico", "test/integration/image-component/base-path/public/test.webp", "test/integration/image-component/base-path/test/static.test.js"]
Importing image doesn't work with basePath
### What version of Next.js are you using? v11.1.2 ### What version of Node.js are you using? v14.16.1 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Other platform ### Describe the Bug When importing image (feature introduced in Next 11) like: ```ts import error404Image from './assets/error-404.png'; ``` `src` field on imported object doesn't take into account `basePath`. So the `src` to image will be: `http://localhost:4202/_next/static/image/...` ### Expected Behavior `src` to image should be: `http://localhost:4202/${basePath}/_next/static/image` Previously used https://www.npmjs.com/package/next-images handled that correctly. ### To Reproduce 1. Create a new next application 2. Configure `basePath` in `next.config.js` 3. Import image like in "Describe the Bug" step 4. Try to 1. `console.log` imported object 2. use it in `Image` or `img` component
https://github.com/vercel/next.js/issues/29289
https://github.com/vercel/next.js/pull/29307
9343b67c110c129b769af7fbdfe752ac9786fdd8
5dbb8704cc6780e377e68574a4aa55352b873b6b
"2021-09-22T09:13:22Z"
javascript
"2021-09-23T23:26:51Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,921
["packages/next/server/base-server.ts", "packages/next/server/router.ts", "test/e2e/i18n-api-support/index.test.ts"]
Rewrites with i18n
### What version of Next.js are you using? 11.1.2 and 11.1.3-canary.14 ### What version of Node.js are you using? 14 and 16 ### What browser are you using? Chrome Firefox Insomnia ### What operating system are you using? Windows, Linux ### How are you deploying your application? Vercel ### Describe the Bug It seems that we cant run POST requests while using i18n on the latest version (it was working on 11.0.x and 11.1.0 but not 11.1.1+) - I tried running my request without i18n and it worked - I tried running my request with i18n but it stopped working - I tried adding/removing the basePath option nothing changed ### Expected Behavior request shouuld be rewrote to the other path ### To Reproduce Minimal Github repository https://github.com/Aviortheking/tests-nextjs
https://github.com/vercel/next.js/issues/28921
https://github.com/vercel/next.js/pull/33966
7c1a51a94f5e00a5e044aa4647b9e552a5ae3e0b
b6b5250c4620b6f76bd82029cb89b4cac27fe486
"2021-09-08T14:37:42Z"
javascript
"2022-03-01T20:53:25Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,687
["packages/next/types/index.d.ts"]
404 SSG pages are not revalidated on next 11.1.2
### What version of Next.js are you using? 11.1.2 ### What version of Node.js are you using? 14.17.4 ### What browser are you using? chrome ### What operating system are you using? ubuntu ### How are you deploying your application? next start and vercel as well ### Describe the Bug I have a page that catch all routes on `/products/[slug].jsx`. I have implemented ISR and `fallback: true`. On `getStaticPaths`, I'm fetching the products that are `published`. The bug I'm facing is I have a published product and to make some changes I changed it's status to unpublished which in return visiting to `/products/my-product` returns `404`. Then, after I'm done with the changes and changed the status to published it keeps showing me the 404 page on reload. But if I visit the product from `<Link />` then it works as expected. ### Expected Behavior A page should be able to revalidate itself from 404. ### To Reproduce Here's my `getStaticProps` function: ```jsx export const getStaticProps = async ({ params }) => { const { slug } = params; const data = await fetch(`http://mydomaim/find/${slug}`); if (data.status === 404) { return { notFound: true, }; } const product = await data.json(); return { props: { name: product.name, }, revalidate: 10, }; }; ```
https://github.com/vercel/next.js/issues/28687
https://github.com/vercel/next.js/pull/29919
fd5522d923f4bf6e8004910759ac0be3fd5791b4
ea0cdc5a3677c94a8c72166450b327c91716bd43
"2021-09-01T03:59:51Z"
javascript
"2021-10-15T02:14:25Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,633
["docs/api-reference/cli.md", "packages/next/cli/next-start.ts", "packages/next/server/lib/start-server.ts", "test/integration/cli/test/index.test.js", "test/unit/cli.test.ts"]
Please expose keepAliveTimeout and headersTimeout without requiring a custom server
### Describe the feature you'd like to request When deploying behind a load balancer its good to configure the application server with a longer timeout than the load balancer. See [AWS ALB reccomendation](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#connection-idle-timeout) > We also recommend that you configure the idle timeout of your application to be larger than the idle timeout configured for the load balancer. AWS defaults a ALB to a 60 second idle timeout so it would be desirable to configure next to have a 61 second timeout. It looks like this has been discussed in a few places with little to no response from the maintainers: - https://github.com/vercel/next.js/discussions/16544 - https://github.com/vercel/next.js/discussions/19618 - https://github.com/vercel/next.js/issues/22204 Here is a discussion of a similar issue in node. https://github.com/nodejs/node/issues/27363 and two blogs about people hitting similar issues with ALB's generating 502s using express servers where the solution was to increase the keepAliveTimeout. - https://adamcrowder.net/posts/node-express-api-and-aws-alb-502/ - https://shuheikagawa.com/blog/2019/04/25/keep-alive-timeout/ ### Describe the solution you'd like Allow setting keepAliveTimeout and headersTimeout. ### Describe alternatives you've considered Ugly hacks > We are doing something similar to patch, just an awk on the bundle after build. As patch replaces the whole file (IIRC) it’s more likely to break things than a regex search and insert. https://github.com/vercel/next.js/discussions/19618#discussioncomment-1218511 > We're using patch-package to fix this issue, please make server.keepAliveTimeout a next.js settings 🙏🏻 https://github.com/vercel/next.js/discussions/19618#discussioncomment-1218160 or setting the ALB/ELB to a timeout of 4 seconds > Heya the only solution I was able to find was to modify the IdleTimeout on the AWS ELB to be 4 seconds, i.e 1 second less than node's default 5 seconds. https://github.com/vercel/next.js/discussions/16544#discussioncomment-142087
https://github.com/vercel/next.js/issues/28633
https://github.com/vercel/next.js/pull/35827
bcd8de32624c444a5e08d119ea8c3c673d7354b2
2b451ee69a1615dc999920b12e2abaf432805c75
"2021-08-30T22:39:19Z"
javascript
"2022-06-26T11:26:51Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,596
["packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js", "test/unit/eslint-plugin-next/no-document-import-in-page.test.ts"]
False positive for `no-document-import-in-page`
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14.17.1 ### What browser are you using? Chrome ### What operating system are you using? Windows ### How are you deploying your application? next start ### Describe the Bug The `@next/next/no-document-import-in-page` ESLint rule displays an error in a custom `_document` if it is located at `pages/_document/index.js`, `pages/_document/index.jsx`, `pages/_document/index.ts`, or `pages/_document/index.tsx`. ### Expected Behavior I expect there to be no ESLint error from the `@next/next/no-document-import-in-page` rule in all valid custom `_document` file locations. ### To Reproduce Create `pages/_document/index.jsx` as follows with the ESLint rule enabled. ```jsx import Document, { Html, Head, Main, NextScript } from 'next/document'; class MyDocument extends Document { render() { return ( <Html lang="en"> <Head /> <body> <Main /> <NextScript /> </body> </Html> ); } } export default MyDocument; ``` This results in an error on line 1.
https://github.com/vercel/next.js/issues/28596
https://github.com/vercel/next.js/pull/28745
801e48eae9cb31fd213d09f81e903ee14aaa2765
9bbba98c015a9c66a786878155d5032b06ef07a0
"2021-08-29T08:39:50Z"
javascript
"2021-09-02T20:51:22Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,582
["examples/with-typescript-graphql/package.json"]
with-typescript-graphql: unable to resolve dependency tree
### What example does this report relate to? with-typescript-graphql ### What version of Next.js are you using? N/A ### What version of Node.js are you using? v16.6.2 ### What browser are you using? N/A ### What operating system are you using? macOS ### How are you deploying your application? npx create-next-app --example with-typescript-graphql with-typescript-graphql-app ### Describe the Bug Cannot setup the TypeScript and GraphQL Example. ### Expected Behavior `npx create-next-app --example with-typescript-graphql with-typescript-graphql-app` should setup the example with no errors. ### To Reproduce Run the following: `npx create-next-app --example with-typescript-graphql with-typescript-graphql-app`
https://github.com/vercel/next.js/issues/28582
https://github.com/vercel/next.js/pull/28637
1fcd8c2e4d4b3ef864e7c53e89bddd1c8009ec58
6be8a043359c01e54668f6d7d9c70d746473a03d
"2021-08-28T13:34:28Z"
javascript
"2021-09-07T15:26:32Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,560
["packages/next/client/route-loader.ts"]
Next/link triggering momentary 'Unhandled Runtime Error' only in dev mode
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14.15.3 ### What browser are you using? Firefox ### What operating system are you using? macOS ### How are you deploying your application? Issue refers to Dev mode only ### Describe the Bug In dev mode, I am getting a momentary runtime error when I click on a dynamic next/link. The error appears for a couple of seconds then the required page renders correctly. NB the error cannot be replicated in production. **Error** ``` Unhandled Runtime Error Error: Failed to load script: /_next/static/chunks/pages/%5BvenueId%5D/events/detail/%5Bdate%5D/%5BeventId%5D.js Call Stack appendScript/</script.onerror node_modules/next/dist/client/route-loader.js (83:51) ``` **Link** ``` <Link href={`/${venueId}/events/detail/${date}/slug=${eventId}`} as={`/${venueId}/events/detail/${date}/${eventId}`} > <a className="font-bold text-lg">{name}</a> </Link> ``` **File Structure to page I am trying to reach:** pages/[venueId]/events/detail/[...slug].tsx The error persists if I attempt to replicate the file structure in my href. Same error with the code as follows: ``` href={`/${venueId}/events/detail/${eventId}`} as={`/${cinemaId}/events/detail/${date}/${eventId}`} ``` The one thing that does get rid of the error is if I simply paste the template literal from the 'as' prop in the 'href' and remove the 'as' prop: ``` href={`/${venueId}/events/detail/${date}/${eventId}`} ``` This renders the required page swiftly and flawlessly without error. **BUT** when I try to navigate 'back' to the previous page using the browser 'back' button, it changes the URL to the correct address for the previous page, but remains on the same page. ### Expected Behavior As a user I want to be able to click on a dynamic 'event' link in a list and have the respective 'detail' content rendered without an error temporarily flashing up. When I have finished with the information, I want to be able to click the browser's 'back' button and be returned to the previous page with the list of dynamic links. ### To Reproduce **Link in question** ``` <Link href={`/${venueId}/events/detail/${date}/slug=${eventId}`} as={`/${venueId}/events/detail/${date}/${eventId}`} > <a className="font-bold text-lg">{name}</a> </Link> ``` **File Structure to page I am trying to reach:** pages/[venueId]/events/detail/[...slug].tsx
https://github.com/vercel/next.js/issues/28560
https://github.com/vercel/next.js/pull/31554
44b4dbcd419b592bea354161a309e0f74dfa67d1
36d3198e3967ae048fa4029b3877c8b8fe7b3520
"2021-08-27T13:54:50Z"
javascript
"2021-11-17T21:33:56Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,547
["packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js", "test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts"]
[ESLint] no-html-link-for-pages false positive on target="_blank"
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 16.6.0 ### What browser are you using? Firefox ### What operating system are you using? Windows 10 ### How are you deploying your application? next lint ### Describe the Bug I have a link to a page on the same domain that opens in a new tab like this: `<a target="_blank" rel="noreferrer" href="/discord">Discord</a>` This route redirects to a Discord invite URL and I don't want to open this route in the same tab. The ESLint rule `no-html-link-for-pages` however complains: > Error: Do not use the HTML <a> tag to navigate to /discord/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages. ### Expected Behavior The rule should pass, since the link is opened in a new tab. ### To Reproduce Use any relative link that opens in a new tab: `<a target="_blank" rel="noreferrer" href="/discord">Discord</a>`
https://github.com/vercel/next.js/issues/28547
https://github.com/vercel/next.js/pull/32780
b769d1be49c25f77a0c1ed5a2c2c4b132c7997a9
4e345f6677f674e6e0493e1186bd8dc23139eea2
"2021-08-27T02:54:47Z"
javascript
"2021-12-25T00:55:43Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,464
["errors/invalid-api-status-body.md", "errors/manifest.json", "packages/next/server/api-utils.ts", "test/integration/api-support/pages/api/status-204.js", "test/integration/api-support/test/index.test.js"]
api endpoint hangs and eventually times out when you res.status(204).send('anything') instead of throwing an error
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14 (hosted on vercel) ### What browser are you using? chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug ```jsx res.status(204) // works as expected res.status(200).send('message') // works as expected res.status(204).send('something') // shits itself ``` The request hangs and eventually gives a timeout error. It took me way longer to debug this than it should have. Completely my fault, I admit it. This isn't an issue when running the app with `yarn dev` It's only an issue for me when it is deployed on vercel. reminder: http code 204 = no response ### Expected Behavior Some options: 1. throw an error when attempting to send any data when the status is 204 2. make the function typesafe so it can't call `.send()` if the status is a 204 3. anything that would have made life a bit easier if there is a sneaky 204 in your code that is meant to be a 200. 4. at the very least, having consistent behaviour between the dev environment and the deployed app would make this much faster to spot. ### To Reproduce `res.status(204).send('message')` when deployed on vercel
https://github.com/vercel/next.js/issues/28464
https://github.com/vercel/next.js/pull/28479
f21685549a05cef495cbfbb33510578387278754
ead10f1f8113f24f3d6dc4e387204da75248b72e
"2021-08-24T15:25:09Z"
javascript
"2021-08-25T15:52:43Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,307
["errors/custom-document-image-import.md", "errors/manifest.json", "packages/next/build/webpack/config/blocks/images/index.ts", "packages/next/build/webpack/config/blocks/images/messages.ts", "packages/next/build/webpack/config/index.ts", "test/integration/invalid-document-image-import/pages/_document.js", "test/integration/invalid-document-image-import/pages/index.js", "test/integration/invalid-document-image-import/public/test.jpg", "test/integration/invalid-document-image-import/test/index.test.js"]
images do not emit images that were imported in _document
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14 ### What browser are you using? chrome ### What operating system are you using? macOS ### How are you deploying your application? Other (serverless aws) ### Describe the Bug When importing images into `_document` next does not emit these image assets into the client build. For example, If i have favicons ```js import favicon from '../assets/icons/favicon.ico'; import favicon16 from '../assets/icons/favicon-16x16.png'; import favicon32 from '../assets/icons/favicon-32x32.png'; ``` They will end up in the serverless directory and are never emitted into the client directory, making them unavailable when the browser attempts to load them If i move these meta tags into `_app`, the assets are imported as expected. ### Expected Behavior Image assets should always emit to the client directory ### To Reproduce import an image in _document and check the .next build output
https://github.com/vercel/next.js/issues/28307
https://github.com/vercel/next.js/pull/28475
c4f9f1e1e0a7aac49d06e6ec12e0bb76840a525c
3b55a37c8168d8043a284bfd85f59e298592674e
"2021-08-19T20:29:16Z"
javascript
"2021-09-06T11:41:18Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,251
["packages/next/client/image.tsx", "packages/next/types/index.d.ts", "test/integration/export-image-loader/test/index.test.js", "test/integration/image-component/default/test/index.test.js"]
Blur placeholder stay visible with JavaScript disabled
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 12.22.1 ### What browser are you using? Chrom, Firefox, Safari ### What operating system are you using? macOS ### How are you deploying your application? next dev, next start ### Describe the Bug When rendering an image with `next/image` that has a blur placeholder set: If JavaScript is disabled in the browser, the `img` tag with blur placeholder as a background is shown on top of the `noscript` image. See this screenshot: <img width="791" alt="nextjs-img-placeholder-noscript" src="https://user-images.githubusercontent.com/33351/129887590-f3fae4ea-a739-468e-b25a-87850da4a62f.png"> And this is the DOM showing that the later `img` overlaps the `noscript` img: <img width="733" alt="nextjs-img-placeholder-dom" src="https://user-images.githubusercontent.com/33351/129887750-54ccd4cd-ebbf-4ef3-b4d4-7fdea880bea9.png"> We could solve this with some CSS trickery like: ```css noscript + img[data-nimg] { visibility: hidden; } ``` But I think it would be best to change the order of both elements (but it's not clear to me if the order is on purpose here). ### Expected Behavior No blur placeholder should be visible when images are loaded with JavaScript disabled. ### To Reproduce * Open the placeholder example in https://github.com/vercel/next.js/blob/master/examples/image-component/pages/placeholder.js * Disable JS in the browser, reload the page * The blur placeholder should stay visible on top of the actual image
https://github.com/vercel/next.js/issues/28251
https://github.com/vercel/next.js/pull/28269
f2fa4f34feba3dda7098eaed9081990129784977
53f0973abaa5db4961dc03b226698d3c4ddbcf2b
"2021-08-18T11:11:32Z"
javascript
"2021-08-19T04:26:07Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,230
["package.json", "yarn.lock"]
[Contributing] Running `yarn` on the Next.js repo fails with an error
### What version of Next.js are you using? v11.1.1-canary.10 ### What version of Node.js are you using? v14.16.0 ### What browser are you using? N/A ### What operating system are you using? Ubuntu 20.04.2 LTS ### How are you deploying your application? N/A ### Describe the Bug Running `yarn` on the Next.js repo fails. ### Expected Behavior For `yarn` to install the Next.js repo dependencies without failing. ### To Reproduce 1. Clone https://github.com/vercel/next.js 2. `cd next.js` & `yarn` 3. Installation error. Snippet of installation error. ```sh [09:53:23] Starting ncc_amp_optimizer info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. lerna ERR! yarn run prepublish stderr: Illegal instruction (core dumped) npm ERR! code ELIFECYCLE npm ERR! errno 132 npm ERR! [email protected] release: `taskr release` npm ERR! Exit status 132 npm ERR! npm ERR! Failed at the [email protected] release script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/p/.npm/_logs/2021-08-18T06_53_23_509Z-debug.log error Command failed with exit code 132. lerna ERR! yarn run prepublish exited 132 in 'next' error Command failed with exit code 132. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. ``` Full [error log](https://gist.github.com/awareness481/230c37e53e153ee7bc8b360c6692da30)
https://github.com/vercel/next.js/issues/28230
https://github.com/vercel/next.js/pull/28347
a0f64ba4a5cf66d12cf742ef16ed851e676cc2de
8737ac08fc18a3fcf263f677980c91fcfde6d075
"2021-08-18T07:01:41Z"
javascript
"2021-08-20T19:54:21Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,215
["packages/next/client/image.tsx", "test/integration/image-component/default/pages/invalid-loader.js", "test/integration/image-component/default/test/index.test.js"]
Unnecessary warnings when using custom image loader with size buckets
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14.17.3 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug After upgrading Next.js, we are seeing lots of errors being printed about a missing width, referencing this page: https://nextjs.org/docs/messages/next-image-missing-loader-width. This error makes the assumption that the loader cannot be resizing the image properly without the width value as a parameter. We have a custom image loader that relies on `size` and `scale` parameters to bucket image requests into several predefined sizes. Based on the needed width, we'll compute the appropriate `size` and `scale` and only those parameters are passed to the image service, like `size=medium-360&scale=1`. There doesn't seem to be any way to silence this error, even though it is working as expected and the images are being optimized within their appropriate buckets. ### Expected Behavior No error, or at least a way to assert that we are using our custom loader in an expected way. ### To Reproduce ```jsx function transcodeImageImageLoader({ src, width }: { src: string; width: number; }): string { const [size, scale] = getSizeForWidth(width); return `https://example.com/${src}?size=${size}&scale=${scale}`; } export default function TranscodeImage(props: ImageProps): ReactElement { return <Image {...props} loader={transcodeImageImageLoader} />; } ```
https://github.com/vercel/next.js/issues/28215
https://github.com/vercel/next.js/pull/30624
842a130218d180522a74bb136dcc637b48f8279e
142af81270637126c05415f73c016922be216540
"2021-08-17T20:39:04Z"
javascript
"2021-10-29T16:54:51Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,200
["packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js", "test/unit/eslint-plugin-next/no-document-import-in-page.test.ts"]
False positive error from no-document-import-in-page rule
### What version of Next.js are you using? 11.1.0 (bug is also present in the latest canary) ### What version of Node.js are you using? 14 LTS ### What browser are you using? n/a ### What operating system are you using? macOS ### How are you deploying your application? n/a ### Describe the Bug The lint rule `no-document-import-in-page` gives a false positive when the path to the linted file includes the word "pages" somewhere besides the actual Next.js pages directory. E.g `/Users/someuser/mypages/src/pages/_document.js`. ### Expected Behavior The rule should pass when `next/document` is imported correctly inside `/pages/_document.js`. ### To Reproduce 1. Create a Next.js app with the word "pages" in the name 2. Create a custom `Document`, https://nextjs.org/docs/advanced-features/custom-document 3. Configure and run `next lint`
https://github.com/vercel/next.js/issues/28200
https://github.com/vercel/next.js/pull/28261
220fa9cd1497f7e21c57ddfcbbbab742d632e0e4
9442925f50502a92fe6c82d2fd05705a52114b1e
"2021-08-17T14:35:04Z"
javascript
"2021-08-25T18:30:49Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,194
["packages/next/cli/next-lint.ts"]
Gitlab CI timeout in "next lint" with Next.js 11.1.0
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14.x ### What browser are you using? Chrome ### What operating system are you using? Linux ### How are you deploying your application? Gitlab CI ### Describe the Bug I am using Gitlab CI to test and deploy a Next.js App, there is a Pipeline Stage for linting: ``` test:lint: stage: test dependencies: - prepare script: - yarn lint ``` It is pretty simple, the "prepare" Stage is bascially "yarn install" and works perfectly fine. Since Next.js 11.1.0, i get a timeout after 1h in the Gitlab Pipeline right after yarn lint: ``` $ yarn lint info - Loaded env from /builds/vetdoc/webapp/.env ✔ No ESLint warnings or errors ERROR: Job failed: execution took longer than 1h0m0s seconds ``` The docker image is just a simple node 14 alpine image, and it does work perfectly fine with Next.js 11.0.1 (tried several times, it is always reproducable for me) ### Expected Behavior The Gitlab CI Pipeline works perfectly fine with Next.js 11.1.0+ ### To Reproduce * Use Gitlab CI with a Node.js 14 Alpine Image * Add a stage with "yarn lint" (which basically uses next lint)
https://github.com/vercel/next.js/issues/28194
https://github.com/vercel/next.js/pull/28299
517ea6dc20a423e0165ce30c237d0e842c2a4efc
4e7691139feec02654297eb16aea22b6fb306f1f
"2021-08-17T11:05:49Z"
javascript
"2021-08-19T17:16:59Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,157
["docs/advanced-features/i18n-routing.md", "packages/next/server/config.ts"]
Release 11.1 introduces i18n limits that blocks us from upgrading.
### What version of Next.js are you using? 10.2.3 -> 11.1 ### What version of Node.js are you using? 14.x, 16.x ### What browser are you using? Chrome, Firefox ### What operating system are you using? macOS ### How are you deploying your application? next build and we then deploy it in our own infra. (Docker and kubernetes) ### Describe the Bug Currently we are using version 10 of next js. After the summer we planned to upgrade to 11. Then with the release of 11.1 we decided to jump directly to latest. We have a site that has 177 locales and it has been working fine (even on version 11.0). However, 11.1 introduced hard limit to 100 without explanation or warning or a workaround. Here is the commit of the documentation https://github.com/vercel/next.js/pull/27542/files And docs in prod https://nextjs.org/docs/advanced-features/i18n-routing#limits-for-the-i18n-config ### Expected Behavior We can upgrade without issues given that it worked before. ### To Reproduce Create a `next.config.js` file with 100 more than i18n locales and then run `next build`.
https://github.com/vercel/next.js/issues/28157
https://github.com/vercel/next.js/pull/28429
74c349daabd4bbcb5a20bb1e0d31c34bebd3b899
f21685549a05cef495cbfbb33510578387278754
"2021-08-16T11:27:28Z"
javascript
"2021-08-25T13:54:38Z"
closed
vercel/next.js
https://github.com/vercel/next.js
28,036
["packages/next/client/index.tsx", "packages/next/client/script.tsx", "packages/next/shared/lib/head-manager-context.ts", "test/integration/script-loader/pages/page3.js", "test/integration/script-loader/test/index.test.js"]
Duplicating Google Maps API with "beforeInteractive" script component
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 15.7.0 ### What browser are you using? Chrome ### What operating system are you using? macOS ### How are you deploying your application? next start ### Describe the Bug When I trying to add google initial script through the Script component it's loads twice and the console log shows an error: `You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.` **_app.js** `function MyApp({ Component, pageProps }) { return ( <ChakraProvider theme={theme}> <Script strategy="beforeInteractive" src="https://maps.googleapis.com/maps/api/js?key=***&libraries=places" /> <Component {...pageProps} /> </ChakraProvider> ); }` ### Expected Behavior For normal work, I need that script loads only once in the header before initializing. ### To Reproduce Just add the line to _app.js: `<Script strategy="beforeInteractive" src="" />`
https://github.com/vercel/next.js/issues/28036
https://github.com/vercel/next.js/pull/28428
ee462442c815c0358085b0340a005a2b68ae4b77
fd1c56e66ab0d9612930efac6cb77985fb91fac7
"2021-08-12T16:05:18Z"
javascript
"2021-08-24T16:07:38Z"
closed
vercel/next.js
https://github.com/vercel/next.js
27,982
["packages/next/build/babel/loader/get-config.ts"]
"Using external babel" spam in Next 11.1
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 14.17.5 ### What browser are you using? Firefox ### What operating system are you using? Ubuntu (WSL) ### How are you deploying your application? N/a ### Describe the Bug In Next 11.1 the `info - Using external babel configuration from /{path}/.babelrc` message is printed repeatedly. When running dev server in a pretty small typescript project, it was printed 8 times. ### Expected Behavior It is printed once when building or when dev server is first started. ### To Reproduce 1. ```bash npx create-next-app ``` 2. In your new app, add a `.babelrc` containing; ``` { "presets": [ "next/babel" ] } ``` 3. Then run ``` npm run build ``` My output is then ``` info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 info - Checking validity of types info - Using external babel configuration from /{path}/.babelrc info - Using external babel configuration from /{path}/.babelrc info - Using external babel configuration from /{path}/.babelrc info - Using external babel configuration from /{path}/.babelrc info - Creating an optimized production build info - Compiled successfully info - Collecting page data info - Generating static pages (3/3) info - Finalizing page optimization ``` Downgrading to `next@~11.0.0` shows nothing about using the external config at all, which is probably not expected either.
https://github.com/vercel/next.js/issues/27982
https://github.com/vercel/next.js/pull/28017
27ccd3cb38e39a1dbfa0d9b8935063814c1f9803
965a280bc2b74a704cecb3098f3be084eba5f15e
"2021-08-11T22:37:38Z"
javascript
"2021-08-12T14:33:25Z"
closed
vercel/next.js
https://github.com/vercel/next.js
27,981
["packages/next/lib/eslint/runLintCheck.ts"]
Yarn lint causes error: The "path" argument must be of type string. Received undefined
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? v15.2.1 ### What browser are you using? Chrome ### What operating system are you using? macOSv11.4 ### How are you deploying your application? Custom deployment ### Describe the Bug I upgraded from [email protected] to [email protected]. Then I followed the guide for extending `@next/eslint-plugin-next` my project already has `.eslintrc` setup. Here's my `.eslintrc` ```json "extends": ["airbnb-typescript-prettier", "plugin:@next/next/recommended"], ``` my `next.config.js` ```js reactStrictMode: true, webpack(config) { config.module.rules.push({ test: /\.svg$/, use: ['@svgr/webpack'], }) return config }, distDir: **'build', ``` # The bug when I run `yarn lint` I get this error ```sh TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ``` Not sure what's causing it. Any idea? ### Expected Behavior Should be able to run `yarn lint` without errors ### To Reproduce I'm not sure how to reproduce in a different repo.
https://github.com/vercel/next.js/issues/27981
https://github.com/vercel/next.js/pull/29823
d8028f553e6df7e159daa1f73ab1264214065bfb
f195650f7489501bb761b27259b71b19a8dc8867
"2021-08-11T22:22:26Z"
javascript
"2021-11-16T13:07:31Z"
closed
vercel/next.js
https://github.com/vercel/next.js
27,980
["packages/next/lib/typescript/writeAppTypeDeclarations.ts", "test/unit/write-app-declarations.test.ts"]
LF to CRLF in `next-env.d.ts`
### What version of Next.js are you using? 11.1.0 ### What version of Node.js are you using? 16.4.0 ### What browser are you using? does not matter ### What operating system are you using? Windows ### How are you deploying your application? next build ### Describe the Bug For whatever reason, when running `next build` or starting a dev server with `next dev` or whatever, it always changes the `LF` line endings in the `next-env.d.ts` file to `CRLF` while making no other meaningful changes in it. That has a few further negative effects: - the file gets marked as changed while obviously contains no meaningful changes (which is already irritating enough) - your ESLint rules break on this file (if your setup expects LF only) which could be double-irritating if you have a pre-commit hook checking your project against ESLint - if get around your pre-commit hook and your `git` is set up to transform any possible `CRLF` to `LF` automatically, then eventually you'll end-up with the proper format being pushed into repo. However once you re-launch the app locally, the story starts over again Am I missing some important configuration detail in next.js? Or am I the only one affected by this? ### Expected Behavior The file is NOT touched by `next.js` unless it has any meaningful changes to be applied there. Also, it should respect the line-endings that already exist in that file. ### To Reproduce Please inquire if this is necessary, but running any setup on Windows having the file with LF endings should already be enough.
https://github.com/vercel/next.js/issues/27980
https://github.com/vercel/next.js/pull/28100
05a732eb7ae4263ec1f1c1d647f4e581edb0c936
23ce41e2bce521b55b9e17e5600dd98e9dfe6955
"2021-08-11T20:56:44Z"
javascript
"2021-09-20T03:55:46Z"
closed
vercel/next.js
https://github.com/vercel/next.js
27,888
["packages/next/build/webpack-config.ts", "test/integration/app-document-remove-hmr/pages/_app.js", "test/integration/app-document-remove-hmr/pages/_document.js", "test/integration/app-document-remove-hmr/pages/index.js", "test/integration/app-document-remove-hmr/test/index.test.js"]
HMR for _app can fail if a custom _app is removed
When using a custom `pages/_app` file and it is removed during development it can cause unexpected errors as seen in the below screen shot. We should handle this gracefully and prevent confusing errors. <details> <summary>screenshot</summary> <img width="565" alt="CleanShot 2021-08-08 at 11 36 29@2x" src="https://user-images.githubusercontent.com/22380829/128719749-af315996-5ae2-44ec-b419-dc98dc14d979.png"> </detaills> A custom `_app` also requires restart if added after the dev server was started which could be improved.
https://github.com/vercel/next.js/issues/27888
https://github.com/vercel/next.js/pull/28227
51559f5c645c6ad8ba1bf2da74bac284015f887e
17d7e59339123e6d395f1714a7c359a5f1d4b6fe
"2021-08-09T14:07:41Z"
javascript
"2021-08-18T11:01:02Z"
closed
vercel/next.js
https://github.com/vercel/next.js
27,873
["packages/next/shared/lib/router/router.ts", "test/e2e/basepath-trailing-slash.test.ts", "test/e2e/basepath.test.ts", "test/lib/e2e-utils.ts"]
Trailing slash automatically removed when using basePath and url has query params
### What version of Next.js are you using? 11.0.1 ### What version of Node.js are you using? 12.16.1 ### What browser are you using? Chrome 92.0.4515.131 ### What operating system are you using? macOS Big Sur ### How are you deploying your application? next build && next export, static files on AWS S3 ### Describe the Bug When URL has query params, e. g. mydomain.com/basePath/?params=1 it automatically removes slash and comes to mydomain.com/basePath?params=1 This is affecting our analytics. It happens only when basePath is configured. We have tested and slash persists without basePath and without query params ### Expected Behavior We would like all URL's to end with a /, even it has query params. Because it affect to analytics and for internal links. ### To Reproduce `next.config.js:` ```javascript { ... basePath: '/base-path', trailingSlash: true, ... } ``` And write to URL any query params after slash and hit enter For example go to domain.com/base-path/?query=true it comes to domain.com/base-path?query=true
https://github.com/vercel/next.js/issues/27873
https://github.com/vercel/next.js/pull/29217
4a5fc41b2472d2957f36b2d50aa41804df5459d6
371ca582d1da1801d8ae5436d108db3f48aefecb
"2021-08-09T08:50:57Z"
javascript
"2021-09-21T14:18:42Z"
closed
vercel/next.js
https://github.com/vercel/next.js
27,783
["packages/next/client/route-loader.ts", "test/integration/preload-viewport/pages/another.js", "test/integration/preload-viewport/test/index.test.js", "test/integration/route-load-cancel-css/test/index.test.js"]
Links randomly not working and the Routing system is broken. (Let's Fix it)
### What version of Next.js are you using? 11.0.1 ### What version of Node.js are you using? v12.0.0 ### What browser are you using? Chrome, Safari, Firefox (mobile and desktop) ### What operating system are you using? macOS ### How are you deploying your application? Vercel ### Describe the Bug Randomly, the links don't work; especially when the link I'm trying to open is more than simple text and images (pages with CSS animations and video). What I have done so far to fix the issue: - Separating all CSS files for each page (A single CSS file caused the javascript to stop working) - Adding an empty CSS file to _app.js (as some suggested) - Removing auto-playing background video from home page. (the situation got better but still, sometimes the Links don't work) - Minimizing buffer in next js config file (as some suggested) - Adding 'a' tag to all next Links - Tried to open links by importing next.js router and onClick handler - Upgrading the next js from ver 10.x to the latest version stable and canary - Removing repository from GitHub and creating a new next js project with the latest dependencies(as some suggested) - Fixing all the deployment warnings - Adding a progress bar to show the page is loading after click (when the links don't work the progress bar goes to end but nothing happens) Now, the front page has no video background with only a few texts and small images but the issue is still happening. ### **This is not some minor issue to get neglected. This is a serious issue that makes the website unusable.** There are so many similar issues and discussion topics opened by developers and the responses from the maintainers show that they have Underestimated the seriousness of this issue. Working Links are a vital part of each website. Don't forget that the reason that so many developers are using Next.js is to bring a better user experience at the end. Some times ago I checked a website from a developer promoted by a tweet and the Links were not working. I told myself that maybe It's still under development and left the website. I didn't know that a refresh might help. this is a nightmare for any startup owner to lose their potential customers without even knowing that the website doesn't work properly. ### **SO, TAKE THIS ISSUE VERY SERIOUSLY, THE LINKS WERE WORKING SINCE THE INVENTION OF THE INTERNET** To show the amount of seriousness this is a screenshot showing the Vercel website itself has some issues opening links. <img width="730" alt="Screen Shot 2021-08-02 at 7 22 54 PM" src="https://user-images.githubusercontent.com/47912427/128306570-68d0d759-86a7-41a9-bb6b-6f919c05e4d0.png"> However, there might be something wrong on my side. Let's fix the issue if you have any suggestions. ### Expected Behavior The Links should work as fast as possible with no unusual delay. ### To Reproduce I developed my website by following the next js tutorials and then I added some CSS animation, background videos, and state handling by useEffect, useState, useRef. - A website with CSS animations or background Videos - This issue might happen more often by having a slow Internet connection (100kB/s - 200KB/s). - Open the website in Chrome incognito or Safari Private page on mobile phones. (The first-time users, experience this issue more often)
https://github.com/vercel/next.js/issues/27783
https://github.com/vercel/next.js/pull/28899
4f8d883acdd561ce4ddb4670324c68920a560ae2
b71df190e57377047e7e3a4f195964cca8818a39
"2021-08-05T07:43:38Z"
javascript
"2021-09-08T06:37:04Z"
closed
vercel/next.js
https://github.com/vercel/next.js
27,744
["packages/next/shared/lib/router/router.ts"]
`unreachable code after return statement` warning
### What version of Next.js are you using? 11.0.1 ### What version of Node.js are you using? 14.17.0 ### What browser are you using? Firefox ### What operating system are you using? Fedora 34 ### How are you deploying your application? next start ### Describe the Bug The browser prints the `unreachable code after return statement` warning. This only happens in production and not with `next dev`. The error refers to the last return statement of this piece of code so it has something to do with the i18n routing. ![image](https://user-images.githubusercontent.com/18398194/128092539-e44f4e8f-33ac-43ab-9a9e-f316a0630f6d.png) ### Expected Behavior It doesn't print the error ### To Reproduce Create a new application with `yarn create next-app`. Set the following configuration in `next.config.js`: ```js module.exports = { reactStrictMode: true, i18n: { defaultLocale: "en", locales: ["en"], }, } ``` Run `yarn build && yarn start`.
https://github.com/vercel/next.js/issues/27744
https://github.com/vercel/next.js/pull/27788
504d478351ee30bce1700370601b32bad6ae2415
d31385597839329243a5be5e5bcf3e42624f32ac
"2021-08-03T22:16:56Z"
javascript
"2021-08-05T13:34:22Z"