language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | vercel | next.js | c6ba29da00a16ecc49f615752bb1490bab8ed9fb.json | docs: use descriptive links instead of "click here" (#25897)
* docs: use descriptive links instead of "click here"
Linking text such as "here" or "click here" is not accessible (and
doesn't look that great either). The best example of why it's better to
use link text that provides context is that some screen read... | examples/with-stencil/packages/test-component/readme.md | @@ -43,7 +43,7 @@ To run the unit tests for the components, run:
npm test
```
-Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component).
+Need help? [Check out our docs](https://stenciljs.com/docs/my-first-component).
## Naming Components
| true |
Other | vercel | next.js | c6ba29da00a16ecc49f615752bb1490bab8ed9fb.json | docs: use descriptive links instead of "click here" (#25897)
* docs: use descriptive links instead of "click here"
Linking text such as "here" or "click here" is not accessible (and
doesn't look that great either). The best example of why it's better to
use link text that provides context is that some screen read... | examples/with-unsplash/README.md | @@ -24,7 +24,7 @@ First, you'll need to [create an account on Unsplash](https://unsplash.com/) if
### Step 1. Create an app on Unsplash
-To create a new application on Unsplash, click [here](https://unsplash.com/oauth/applications/new) or go to https://unsplash.com/oauth/applications/new.
+Create a [new applicatio... | true |
Other | vercel | next.js | c6ba29da00a16ecc49f615752bb1490bab8ed9fb.json | docs: use descriptive links instead of "click here" (#25897)
* docs: use descriptive links instead of "click here"
Linking text such as "here" or "click here" is not accessible (and
doesn't look that great either). The best example of why it's better to
use link text that provides context is that some screen read... | examples/with-xstate/README.md | @@ -1,6 +1,6 @@
# XState example
-This example shows how to integrate XState in Next.js. For more info about XState you can visit [here](https://xstate.js.org/).
+This example shows how to integrate XState in Next.js. [Learn more about XState](https://xstate.js.org/).
## Preview
| true |
Other | vercel | next.js | 00c00f2fca95218f72388c21c77851bd447e4678.json | add global callback for refresh latency (#25944)
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next/client/dev/error-overlay/hot-dev-client.js | @@ -179,7 +179,11 @@ function onFastRefresh(hasUpdates) {
DevOverlay.onRefresh()
}
- console.log('[Fast Refresh] done')
+ const latency = Date.now() - startLatency
+ console.log(`[Fast Refresh] done in ${latency}ms`)
+ if (self.__NEXT_HMR_LATENCY_CB) {
+ self.__NEXT_HMR_LATENCY_CB(latency)
+ }
}
/... | false |
Other | vercel | next.js | d6105c950291924ee707f97290f9c019c4ab91a4.json | Add delay to placeholder removal (#25916)
* Add delay to placeholder removal
* Increase jest timeout for image tests
* Use check instead of immediately expecting the result
Co-authored-by: Tim Neutkens <timneutkens@me.com> | packages/next/client/image.tsx | @@ -261,6 +261,8 @@ function defaultImageLoader(loaderProps: ImageLoaderProps) {
// See https://stackoverflow.com/q/39777833/266535 for why we use this ref
// handler instead of the img's onLoad attribute.
+// 1500ms delay in removing placeholder is to prevent flash of white between
+// image load and image render.... | true |
Other | vercel | next.js | d6105c950291924ee707f97290f9c019c4ab91a4.json | Add delay to placeholder removal (#25916)
* Add delay to placeholder removal
* Increase jest timeout for image tests
* Use check instead of immediately expecting the result
Co-authored-by: Tim Neutkens <timneutkens@me.com> | test/integration/image-component/default/test/index.test.js | @@ -16,7 +16,7 @@ import {
import webdriver from 'next-webdriver'
import { join } from 'path'
-jest.setTimeout(1000 * 60)
+jest.setTimeout(1000 * 80)
const appDir = join(__dirname, '../')
@@ -607,14 +607,15 @@ describe('Image Component Tests', () => {
let browser
try {
browser = await we... | true |
Other | vercel | next.js | 3821662eb7df7ad16f2c727310d90797090f408f.json | Replace `CLIEngine` with `ESLint` (#25801)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | lint-staged.config.js | @@ -1,7 +1,7 @@
const escape = require('shell-quote').quote
-const { CLIEngine } = require('eslint')
+const { ESLint } = require('eslint')
-const cli = new CLIEngine({})
+const eslint = new ESLint()
const isWin = process.platform === 'win32'
module.exports = {
@@ -12,7 +12,7 @@ module.exports = {
return [
... | false |
Other | vercel | next.js | 381522223825b51778fae3ed3eba2c1233a99e7e.json | fix: use key while rendering arrays (#25902)
Fixes one of the items that was mentioned in #25854.
It fixes warning from React in `with-react-multi-carousel`. | examples/with-react-multi-carousel/pages/index.js | @@ -59,7 +59,7 @@ class Index extends Component {
deviceType={''}
>
{images.map((image) => {
- return <Image url={image} alt={image} />
+ return <Image key={image} url={image} alt={image} />
})}
</Carousel>
</div> | false |
Other | vercel | next.js | bb973be201b22b3c59c0fdfdcb7f95779cb85c36.json | fix: move viewport meta tag to head in _app.js (#25901)
Fixes one of the items that was mentioned in #25854.
It fixes the warning in `with-next-page-transitions` by moving the viewport tag to `_app.js` from `_document.js` | examples/with-next-page-transitions/pages/_app.js | @@ -1,3 +1,4 @@
+import Head from 'next/head'
import { PageTransition } from 'next-page-transitions'
import Loader from '../components/Loader'
@@ -7,6 +8,9 @@ const TIMEOUT = 400
function MyApp({ Component, pageProps }) {
return (
<>
+ <Head>
+ <meta name="viewport" content="initial-scale=1.0, ... | true |
Other | vercel | next.js | bb973be201b22b3c59c0fdfdcb7f95779cb85c36.json | fix: move viewport meta tag to head in _app.js (#25901)
Fixes one of the items that was mentioned in #25854.
It fixes the warning in `with-next-page-transitions` by moving the viewport tag to `_app.js` from `_document.js` | examples/with-next-page-transitions/pages/_document.js | @@ -10,10 +10,6 @@ export default class MyDocument extends Document {
return (
<Html lang="en">
<Head>
- <meta
- name="viewport"
- content="initial-scale=1.0, width=device-width"
- />
<link
rel="stylesheet"
href="https://m... | true |
Other | vercel | next.js | a79eb4fd51798d06ef33d2a6b9094ae8b38cabb5.json | Fix immutable header on static image (#25914)
This PR fixes a bug where the first request has the correct immutable header but subsequent requests do not.
Depends on #25909 | packages/next/next-server/server/image-optimizer.ts | @@ -163,7 +163,12 @@ export async function imageOptimizer(
const contentType = getContentType(extension)
const fsPath = join(hashDir, file)
if (now < expireAt) {
- res.setHeader('Cache-Control', 'public, max-age=0, must-revalidate')
+ res.setHeader(
+ 'Cache-Contr... | true |
Other | vercel | next.js | a79eb4fd51798d06ef33d2a6b9094ae8b38cabb5.json | Fix immutable header on static image (#25914)
This PR fixes a bug where the first request has the correct immutable header but subsequent requests do not.
Depends on #25909 | test/integration/image-optimizer/test/index.test.js | @@ -512,11 +512,21 @@ function runTests({ w, isDev, domains }) {
q: 100,
}
const opts = { headers: { accept: 'image/webp' } }
- const res = await fetchViaHTTP(appPort, '/_next/image', query, opts)
- expect(res.status).toBe(200)
- expect(res.headers.get('cache-control')).toBe(
+
+ ... | true |
Other | vercel | next.js | c8624091b9ddf48ff31dce5f376e59c5100b1a19.json | Improve check for eslint version (#25910)
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next/lib/eslint/runLintCheck.ts | @@ -7,7 +7,6 @@ import * as CommentJson from 'next/dist/compiled/comment-json'
import { formatResults } from './customFormatter'
import { writeDefaultConfig } from './writeDefaultConfig'
-import { getPackageVersion } from '../get-package-version'
import { findPagesDir } from '../find-pages-dir'
import { Compile... | false |
Other | vercel | next.js | ab450aaa1e0a741cd1dd8cef0ff14dba3ce64027.json | Adjust JPEG quality when generating placeholder (#25904)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/build/webpack/loaders/next-image-loader.js | @@ -2,7 +2,7 @@ import loaderUtils from 'next/dist/compiled/loader-utils'
import sizeOf from 'image-size'
import { processBuffer } from '../../../next-server/server/lib/squoosh/main'
-const PLACEHOLDER_SIZE = 6
+const PLACEHOLDER_SIZE = 8
async function nextImageLoader(content) {
const context = this.rootCont... | true |
Other | vercel | next.js | ab450aaa1e0a741cd1dd8cef0ff14dba3ce64027.json | Adjust JPEG quality when generating placeholder (#25904)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | test/integration/image-component/default/test/static.test.js | @@ -49,12 +49,12 @@ const runTests = () => {
})
it('Should add a blurry placeholder to statically imported jpg', async () => {
expect(html).toContain(
- `style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-widt... | true |
Other | vercel | next.js | d820542a15abbf8a11accdac5ad08323ae994e18.json | fix(21606): consider scroll option when using shallow routing (#24888)
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
fixes [#21606](https://github.com/vercel/next.js/issues/21606)
### Description
When using shallow routing and wanting to scroll to top by setting the `scroll... | packages/next/client/link.tsx | @@ -94,8 +94,8 @@ function linkClicked(
e.preventDefault()
// avoid scroll for urls with anchor refs
- if (scroll == null) {
- scroll = as.indexOf('#') < 0
+ if (scroll == null && as.indexOf('#') >= 0) {
+ scroll = false
}
// replace state instead of push if prop is present | true |
Other | vercel | next.js | d820542a15abbf8a11accdac5ad08323ae994e18.json | fix(21606): consider scroll option when using shallow routing (#24888)
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
fixes [#21606](https://github.com/vercel/next.js/issues/21606)
### Description
When using shallow routing and wanting to scroll to top by setting the `scroll... | packages/next/next-server/lib/router/router.ts | @@ -816,11 +816,6 @@ export default class Router implements BaseRouter {
this.isReady = true
}
- // Default to scroll reset behavior unless explicitly specified to be
- // `false`! This makes the behavior between using `Router#push` and a
- // `<Link />` consistent.
- options.scroll = !!(optio... | true |
Other | vercel | next.js | d820542a15abbf8a11accdac5ad08323ae994e18.json | fix(21606): consider scroll option when using shallow routing (#24888)
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
fixes [#21606](https://github.com/vercel/next.js/issues/21606)
### Description
When using shallow routing and wanting to scroll to top by setting the `scroll... | test/integration/client-navigation/pages/nav/shallow-routing.js | @@ -22,10 +22,10 @@ export default withRouter(
return router.query.counter ? parseInt(router.query.counter) : 0
}
- increase() {
+ increase(scroll) {
const counter = this.getCurrentCounter()
const href = `/nav/shallow-routing?counter=${counter + 1}`
- Router.push(href, href, { sha... | true |
Other | vercel | next.js | d820542a15abbf8a11accdac5ad08323ae994e18.json | fix(21606): consider scroll option when using shallow routing (#24888)
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
fixes [#21606](https://github.com/vercel/next.js/issues/21606)
### Description
When using shallow routing and wanting to scroll to top by setting the `scroll... | test/integration/client-navigation/test/index.test.js | @@ -881,6 +881,22 @@ describe('Client Navigation', () => {
})
})
+ it('should scroll to top when the scroll option is set to true', async () => {
+ const browser = await webdriver(context.appPort, '/nav/shallow-routing')
+ await browser.eval(() =>
+ document.querySelector('#increaseWithScroll').sc... | true |
Other | vercel | next.js | 3b76d3371a4eca007c09e40afe4818bac6590d02.json | Fix command in upgrade guide (#25879)
This PR fixed command in upgrade guide. | docs/upgrading.md | @@ -19,7 +19,7 @@ npm install react@latest react-dom@latest
Or using `yarn`:
```
-yarn add next@latest react-dom@latest
+yarn add react@latest react-dom@latest
```
### Remove `super.componentDidCatch()` from `pages/_app.js` | false |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | .github/workflows/build_test_deploy.yml | @@ -156,15 +156,15 @@ jobs:
steps:
- run: exit 0
- testFutureDependencies:
- name: Webpack 5 (Basic, Production, Acceptance)
+ testLegacyWebpack:
+ name: Webpack 4 (Basic, Production, Acceptance)
runs-on: ubuntu-latest
needs: build
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | errors/future-webpack5-moved-to-webpack5.md | @@ -0,0 +1,33 @@
+# `future.webpack5` has been moved to `webpack5`
+
+#### Why This Error Occurred
+
+The `future.webpack5` option has been moved to `webpack5` in `next.config.js`.
+
+#### Possible Ways to Fix It
+
+If you had the value `true` you can removed the option as webpack 5 is now the default for all Next.js a... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | errors/webpack5.md | @@ -2,17 +2,17 @@
#### Why This Message Occurred
-Next.js will soon adopt webpack 5 as the default for compilation. We've spent a lot of effort into ensuring the transition from webpack 4 to 5 will be as smooth as possible. For example Next.js now comes with both webpack 4 and 5 allowing you to adopt webpack 5 by ... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | packages/next/next-server/server/config-shared.ts | @@ -27,13 +27,16 @@ export type NextConfig = { [key: string]: any } & {
}
>
redirects?: () => Promise<Redirect[]>
-
trailingSlash?: boolean
+ webpack5?: false
future: {
+ /**
+ * @deprecated this options was moved to the top level
+ */
+ webpack5?: false
strictPostcssConfigurati... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | packages/next/next-server/server/config-utils-worker.ts | @@ -22,11 +22,9 @@ export function install(useWebpack5: boolean) {
export type CheckReasons =
| 'test-mode'
- | 'no-config'
+ | 'default'
+ | 'flag-disabled'
| 'future-flag'
- | 'no-future-flag'
- | 'no-webpack-config'
- | 'webpack-config'
export type CheckResult = {
enabled: boolean
@@ -43,20 +41,... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | packages/next/next-server/server/config-utils.ts | @@ -9,16 +9,10 @@ export { install, shouldLoadWithWebpack5 }
function reasonMessage(reason: CheckReasons) {
switch (reason) {
- case 'future-flag':
- return 'future.webpack5 option enabled'
- case 'no-future-flag':
- return 'future.webpack5 option disabled'
- case 'no-config':
- return 'no... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/.stats-app/stats-config.js | @@ -65,9 +65,6 @@ module.exports = {
content: `
module.exports = {
generateBuildId: () => 'BUILD_ID',
- future: {
- webpack5: true
- },
webpack(config) {
config.optimization.minimize = false
... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/basic/test/index.test.js | @@ -36,6 +36,12 @@ describe('Basic Features', () => {
it('should polyfill Node.js modules', async () => {
const browser = await webdriver(context.appPort, '/node-browser-polyfills')
+
+ console.error({
+ logs: await browser.log('browser'),
+ content: await browser.eval('document.documentElement.i... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/config/next.config.js | @@ -3,6 +3,8 @@ const withSass = require('@zeit/next-sass')
const path = require('path')
module.exports = withCSS(
withSass({
+ // @zeit/next-sass is not supported with webpack 5
+ webpack5: false,
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 ... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/css-fixtures/custom-configuration-legacy/next.config.js | @@ -1,6 +1,8 @@
const withCSS = require('@zeit/next-css')
module.exports = withCSS({
+ // @zeit/next-css is not supported with webpack 5
+ webpack5: false,
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60, | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/externals/next.config.js | @@ -7,7 +7,4 @@ module.exports = {
return config
},
- future: {
- webpack5: true,
- },
} | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/fallback-modules/test/index.test.js | @@ -48,7 +48,9 @@ describe('Build Output', () => {
expect(parseFloat(indexSize)).toBeGreaterThanOrEqual(2)
expect(indexSize.endsWith('kB')).toBe(true)
- expect(parseFloat(indexFirstLoad)).toBeLessThanOrEqual(67.9)
+ expect(parseFloat(indexFirstLoad)).toBeLessThanOrEqual(
+ process.env.N... | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/legacy-sass/next.config.js | @@ -1,2 +1,5 @@
const withSass = require('@zeit/next-sass')
-module.exports = withSass()
+module.exports = withSass({
+ // @zeit/next-sass is not supported with webpack 5
+ webpack5: false,
+}) | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/next-dynamic-css/next.config.js | @@ -1,5 +1,3 @@
module.exports = {
- future: {
- webpack5: false,
- },
+ webpack5: false,
} | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/production-config/next.config.js | @@ -3,6 +3,8 @@ const withSass = require('@zeit/next-sass')
const path = require('path')
module.exports = withCSS(
withSass({
+ // @zeit/next-sass is not supported with webpack 5
+ webpack5: false,
env: {
...(process.env.ENABLE_ENV_FAIL_UNDERSCORE
? { | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/size-limit/test/index.test.js | @@ -85,6 +85,6 @@ describe('Production response size', () => {
const delta = responseSizesBytes / 1024
// Expected difference: < 0.5
- expect(delta).toBeCloseTo(289.3, 0)
+ expect(delta).toBeCloseTo(286.8, 0)
})
}) | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/webpack-require-hook/next.config.js | @@ -1,8 +1,5 @@
module.exports = {
- future: {
- webpack5: true,
- },
- webpack(config, options) {
+ webpack(config) {
console.log('Initialized config')
if (
require('webpack/lib/node/NodeTargetPlugin') !== | true |
Other | vercel | next.js | e1502bc9a5fa112c47bee0c912dbcc7c0b5e484c.json | Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps
Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.
* Update tests
* Update test to run on webpack 4 instead of webpack 5
* disable webpack5 for legacy tests
... | test/integration/worker-loader/next.config.js | @@ -1,4 +1,7 @@
module.exports = {
+ // worker-loader is webpack 4 specific, new Worker should be used
+ // in webpack 5
+ webpack5: false,
webpack: (config, { isServer }) => {
config.module.rules.unshift({
test: /\.worker\.(js|ts|tsx)$/, | true |
Other | vercel | next.js | 5d99c09985a2aa15bfb576c1f0ee32c6c074af9c.json | Fix "env" key in babelrc with new Babel mode (#25841)
Fixes an issue where "env" would be ignored and would crash if there was no top level "presets". Also found that webpack did not invalidate the cache on changes to the babel config, so I also fixed that. | packages/next/build/babel/loader/get-config.ts | @@ -156,29 +156,10 @@ function getCustomBabelConfig(configFilePath: string) {
return require(configFilePath)
}
throw new Error(
- 'The Next Babel loader does not support MJS or CJS config files.'
+ 'The Next.js Babel loader does not support .mjs or .cjs config files.'
)
}
-function getCustomPrese... | true |
Other | vercel | next.js | 5d99c09985a2aa15bfb576c1f0ee32c6c074af9c.json | Fix "env" key in babelrc with new Babel mode (#25841)
Fixes an issue where "env" would be ignored and would crash if there was no top level "presets". Also found that webpack did not invalidate the cache on changes to the babel config, so I also fixed that. | packages/next/build/babel/loader/types.d.ts | @@ -11,7 +11,6 @@ export interface NextBabelLoaderOptions {
isServer: boolean
development: boolean
pagesDir: string
- presets: any[]
sourceMaps?: any[]
overrides: any
caller: any | true |
Other | vercel | next.js | 5d99c09985a2aa15bfb576c1f0ee32c6c074af9c.json | Fix "env" key in babelrc with new Babel mode (#25841)
Fixes an issue where "env" would be ignored and would crash if there was no top level "presets". Also found that webpack did not invalidate the cache on changes to the babel config, so I also fixed that. | test/integration/babel-custom/fixtures/babel-env/.babelrc | @@ -0,0 +1,22 @@
+{
+ "env": {
+ "development": {
+ "presets": ["next/babel"]
+ },
+ "production": {
+ "presets": ["next/babel"]
+ },
+ "test": {
+ "presets": [
+ [
+ "next/babel",
+ {
+ "preset-env": {
+ "modules": "commonjs"
+ ... | true |
Other | vercel | next.js | 5d99c09985a2aa15bfb576c1f0ee32c6c074af9c.json | Fix "env" key in babelrc with new Babel mode (#25841)
Fixes an issue where "env" would be ignored and would crash if there was no top level "presets". Also found that webpack did not invalidate the cache on changes to the babel config, so I also fixed that. | test/integration/babel-custom/fixtures/babel-env/pages/index.js | @@ -0,0 +1 @@
+export default () => <h1>Hello World</h1> | true |
Other | vercel | next.js | 5d99c09985a2aa15bfb576c1f0ee32c6c074af9c.json | Fix "env" key in babelrc with new Babel mode (#25841)
Fixes an issue where "env" would be ignored and would crash if there was no top level "presets". Also found that webpack did not invalidate the cache on changes to the babel config, so I also fixed that. | test/integration/babel-custom/test/index.test.js | @@ -6,6 +6,10 @@ import { nextBuild } from 'next-test-utils'
jest.setTimeout(1000 * 60 * 5)
describe('Babel', () => {
+ it('should allow setting babelrc env', async () => {
+ await nextBuild(join(__dirname, '../fixtures/babel-env'))
+ })
+
it('should allow setting targets.browsers', async () => {
await... | true |
Other | vercel | next.js | 7038b623e07aa2f4f08a4b6c8115020ee940c57f.json | Fix occasional test failures (#25855) | run-tests.js | @@ -20,6 +20,8 @@ const UNIT_TEST_EXT = '.unit.test.js'
const DEV_TEST_EXT = '.dev.test.js'
const PROD_TEST_EXT = '.prod.test.js'
+const NON_CONCURRENT_TESTS = ['test/integration/basic/test/index.test.js']
+
// which types we have configured to run separate
const configuredTestTypes = [UNIT_TEST_EXT]
@@ -217,6 ... | true |
Other | vercel | next.js | 7038b623e07aa2f4f08a4b6c8115020ee940c57f.json | Fix occasional test failures (#25855) | test/integration/rewrite-with-browser-history/test/index.test.js | @@ -30,7 +30,7 @@ const runTests = () => {
.click()
.waitForElementByCss('#index')
- await browser.back()
+ await browser.back().waitForElementByCss('#another')
expect(await browser.elementByCss('#another').text()).toBe('another page')
| true |
Other | vercel | next.js | 5be354ede6b35f41b206d9c27f48a0ea34f32c32.json | Add note to upgrading guide about React version (#25849)
Co-authored-by: Gerald Monaco <gbmonaco@google.com> | docs/upgrading.md | @@ -6,6 +6,22 @@ description: Learn how to upgrade Next.js.
## Upgrading from version 10 to 11
+## Upgrade React version to latest
+
+Most applications already use the latest version of React, with Next.js 11 the minimum React version has been updated to 17.0.2.
+
+To upgrade you can run the following command:
+
+... | false |
Other | vercel | next.js | 8ae12db1e3278ed31e44cd391ef9219628580fe6.json | ESLint Plugin: Fix Document and Head import rules (#25730) | errors/no-document-import-in-page.md | @@ -2,11 +2,11 @@
### Why This Error Occurred
-`next/document` was imported in a page outside of `pages/_document.js`. This can cause unexpected issues in your application.
+`next/document` was imported in a page outside of `pages/_document.js` (or `pages/_document.tsx` if you are using TypeScript). This can cause... | true |
Other | vercel | next.js | 8ae12db1e3278ed31e44cd391ef9219628580fe6.json | ESLint Plugin: Fix Document and Head import rules (#25730) | packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js | @@ -16,7 +16,7 @@ module.exports = {
}
const page = context.getFilename().split('pages')[1]
- if (!page || path.parse(page).name === '_document') {
+ if (!page || path.parse(page).name.startsWith('_document')) {
return
}
| true |
Other | vercel | next.js | 8ae12db1e3278ed31e44cd391ef9219628580fe6.json | ESLint Plugin: Fix Document and Head import rules (#25730) | packages/eslint-plugin-next/lib/rules/no-head-import-in-document.js | @@ -15,7 +15,7 @@ module.exports = {
}
const document = context.getFilename().split('pages')[1]
- if (!document || path.parse(document).name !== '_document') {
+ if (!document || !path.parse(document).name.startsWith('_document')) {
return
}
| true |
Other | vercel | next.js | 8ae12db1e3278ed31e44cd391ef9219628580fe6.json | ESLint Plugin: Fix Document and Head import rules (#25730) | test/eslint-plugin-next/no-document-import-in-page.unit.test.js | @@ -44,6 +44,20 @@ ruleTester.run('no-document-import-in-page', rule, {
`,
filename: 'pages/_document.tsx',
},
+ {
+ code: `import Document from "next/document"
+
+ export default class MyDocument extends Document {
+ render() {
+ return (
+ <Html>
+ </Html>
+ ... | true |
Other | vercel | next.js | 8ae12db1e3278ed31e44cd391ef9219628580fe6.json | ESLint Plugin: Fix Document and Head import rules (#25730) | test/eslint-plugin-next/no-head-import-in-document.unit.test.js | @@ -84,5 +84,35 @@ ruleTester.run('no-head-import-in-document', rule, {
},
],
},
+ {
+ code: `
+ import Document, { Html, Main, NextScript } from 'next/document'
+ import Head from 'next/head'
+
+ class MyDocument extends Document {
+ render() {
+ return... | true |
Other | vercel | next.js | 204a95586dccefb24bc0790f2a39f267310dc402.json | Remove useMaybeDeferContent hook (#34506) | packages/next/pages/_document.tsx | @@ -492,7 +492,6 @@ export class Head extends Component<
unstable_runtimeJS,
unstable_JsPreload,
disableOptimizedLoading,
- useMaybeDeferContent,
optimizeCss,
optimizeFonts,
runtime,
@@ -610,36 +609,96 @@ export class Head extends Component<
inAmpMode
)
- ... | true |
Other | vercel | next.js | 204a95586dccefb24bc0790f2a39f267310dc402.json | Remove useMaybeDeferContent hook (#34506) | packages/next/server/render.tsx | @@ -1474,7 +1474,6 @@ export async function renderToHTML(
head: documentResult.head,
headTags: documentResult.headTags,
styles: documentResult.styles,
- useMaybeDeferContent,
crossOrigin: renderOpts.crossOrigin,
optimizeCss: renderOpts.optimizeCss,
optimizeFonts: renderOpts.optimizeFont... | true |
Other | vercel | next.js | 204a95586dccefb24bc0790f2a39f267310dc402.json | Remove useMaybeDeferContent hook (#34506) | packages/next/shared/lib/html-context.ts | @@ -1,5 +1,5 @@
import type { BuildManifest } from '../../server/get-page-files'
-import type { NEXT_DATA, MaybeDeferContentHook } from './utils'
+import type { NEXT_DATA } from './utils'
import { createContext } from 'react'
@@ -29,7 +29,6 @@ export type HtmlProps = {
disableOptimizedLoading?: boolean
styl... | true |
Other | vercel | next.js | 204a95586dccefb24bc0790f2a39f267310dc402.json | Remove useMaybeDeferContent hook (#34506) | packages/next/shared/lib/utils.ts | @@ -187,11 +187,6 @@ export type DocumentInitialProps = RenderPageResult & {
export type DocumentProps = DocumentInitialProps & HtmlProps
-export type MaybeDeferContentHook = (
- name: string,
- contentFn: () => JSX.Element
-) => [boolean, JSX.Element]
-
/**
* Next `API` route request
*/ | true |
Other | vercel | next.js | 204a95586dccefb24bc0790f2a39f267310dc402.json | Remove useMaybeDeferContent hook (#34506) | test/unit/use-maybe-defer-content.test.ts | @@ -1,12 +0,0 @@
-/* eslint-env jest */
-import { useMaybeDeferContent } from 'next/dist/server/render'
-import React from 'react'
-
-describe('useMaybeDeferContent', () => {
- it('returns raw content when isDeferred is false', () => {
- const rawContent = React.createElement('p', {}, 'hello world')
- const [isD... | true |
Other | vercel | next.js | a52bd712fe797b59cfd05ceaa4c33096a0c346ff.json | Update details about Cache Control Headers (#34416)
We need to update details about adding Serverless Functions' `Cache-Control` headers to `next.config.js` files. And inform developers that these headers cannot be set in `next.config.js` files.
## Bug
- [x] [Slack Thread](https://vercel.slack.com/archives/C02F56A54... | docs/api-reference/next.config.js/headers.md | @@ -376,7 +376,20 @@ module.exports = {
### Cache-Control
-Cache-Control headers set in next.config.js will be overwritten in production to ensure that static assets can be cached effectively. If you need to revalidate the cache of a page that has been [statically generated](https://nextjs.org/docs/basic-features/... | false |
Other | vercel | next.js | ae3e55dca471178ef0ceccfd7a6357b09f9a24cf.json | Fix 404 links in React 18 docs (#34486)
https://nextjs.org/docs/advanced-features/react-18/overview
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. M... | docs/advanced-features/react-18/overview.md | @@ -19,10 +19,10 @@ You can now start using React 18's new APIs like `startTransition` and `Suspense
Streaming server-rendering (SSR) is an experimental feature in Next.js 12. When enabled, SSR will use the same [Edge Runtime](/docs/api-reference/edge-runtime.md) as [Middleware](/docs/middleware.md).
-[Learn how t... | false |
Other | vercel | next.js | d4d79b2d9b9c43ed1061a3d3beeb3099368669a8.json | Fix chunk buffering for server components (#34474) | packages/next/server/render.tsx | @@ -1764,19 +1764,28 @@ function createInlineDataStream(
if (!dataStreamFinished && dataStream) {
const dataStreamReader = dataStream.getReader()
- dataStreamFinished = (async () => {
- try {
- while (true) {
- const { done, value } = await dataStreamReader.read... | false |
Other | vercel | next.js | 634926d8df03fa0df3b3bbed699feb1ff16e0ddb.json | Add Error Handing section for ISR (#34360)
* Add Error Handing section for ISR
* Apply suggestions from code review
* update check
Co-authored-by: JJ Kasper <jj@jjsweb.site> | docs/basic-features/data-fetching/incremental-static-regeneration.md | @@ -24,7 +24,7 @@ description: 'Learn how to create or update static pages at runtime with Increme
Next.js allows you to create or update static pages _after_ you’ve built your site. Incremental Static Regeneration (ISR) enables you to use static-generation on a per-page basis, **without needing to rebuild the entir... | true |
Other | vercel | next.js | 634926d8df03fa0df3b3bbed699feb1ff16e0ddb.json | Add Error Handing section for ISR (#34360)
* Add Error Handing section for ISR
* Apply suggestions from code review
* update check
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next/server/response-cache.ts | @@ -125,11 +125,7 @@ export default class ResponseCache {
;(async () => {
try {
const cachedResponse = key ? await this.incrementalCache.get(key) : null
- if (
- cachedResponse &&
- (!context.isManualRevalidate ||
- cachedResponse.revalidateAfter === false)
- ... | true |
Other | vercel | next.js | 634926d8df03fa0df3b3bbed699feb1ff16e0ddb.json | Add Error Handing section for ISR (#34360)
* Add Error Handing section for ISR
* Apply suggestions from code review
* update check
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/e2e/prerender.test.ts | @@ -1939,7 +1939,7 @@ describe('Prerender', () => {
expect($4('#time').text()).not.toBe(initialTime)
})
- it('should not manual revalidate for revalidate: false', async () => {
+ it('should manual revalidate for revalidate: false', async () => {
const html = await renderViaHTTP(
... | true |
Other | vercel | next.js | 2f7951892ec8613a05458db2263f2de94112a0d2.json | fix double render in strict mode (#34333)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/client/index.tsx | @@ -775,9 +775,11 @@ if (process.env.__NEXT_RSC) {
serialized?: string
_fresh?: boolean
}) => {
+ React.useEffect(() => {
+ rscCache.delete(cacheKey)
+ })
const response = useServerResponse(cacheKey, serialized)
const root = response.readRoot()
- rscCache.delete(cacheKey)
retur... | true |
Other | vercel | next.js | 2f7951892ec8613a05458db2263f2de94112a0d2.json | fix double render in strict mode (#34333)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | test/integration/react-streaming-and-server-components/app/next.config.js | @@ -1,6 +1,7 @@
const withReact18 = require('../../react-18/test/with-react-18')
module.exports = withReact18({
+ reactStrictMode: true,
onDemandEntries: {
maxInactiveAge: 1000 * 60 * 60,
}, | true |
Other | vercel | next.js | 7be6359aff34e0e8c27fe4e16ccd32d6cd0ca5e4.json | Fix typo on `getInitialProps` (#34309)
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implement... | docs/advanced-features/custom-document.md | @@ -48,7 +48,7 @@ Or add a `className` to the `body` tag:
> **Note:** This is advanced and only needed for libraries like CSS-in-JS to support server-side rendering. This is not needed for built-in `styled-jsx` support.
-To prepare for [React 18](/docs/advanced-features/react-18.md), we recommend avoiding customiz... | false |
Other | vercel | next.js | 4bfcf8345c5c40271e2aecc72d34640fde3c44cc.json | enhance: detect ESM by ast type (#35627)
Simplify the esmodule detection. If there's any import/exprt usage, it will return `Module` in ast.type otherwise `Script` when `isModule` is set to `"unknown"` | packages/next/build/entries.ts | @@ -135,7 +135,7 @@ export async function getPageRuntime(
try {
const { body } = await parse(pageContent, {
filename: pageFilePath,
- isModule: true,
+ isModule: 'unknown',
})
for (const node of body) { | true |
Other | vercel | next.js | 4bfcf8345c5c40271e2aecc72d34640fde3c44cc.json | enhance: detect ESM by ast type (#35627)
Simplify the esmodule detection. If there's any import/exprt usage, it will return `Module` in ast.type otherwise `Script` when `isModule` is set to `"unknown"` | packages/next/build/webpack/loaders/next-flight-client-loader.ts | @@ -47,7 +47,7 @@ async function parseModuleInfo(
): Promise<void> {
const { body } = await parse(transformedSource, {
filename: resourcePath,
- isModule: true,
+ isModule: 'unknown',
})
for (let i = 0; i < body.length; i++) {
const node = body[i] | true |
Other | vercel | next.js | 4bfcf8345c5c40271e2aecc72d34640fde3c44cc.json | enhance: detect ESM by ast type (#35627)
Simplify the esmodule detection. If there's any import/exprt usage, it will return `Module` in ast.type otherwise `Script` when `isModule` is set to `"unknown"` | packages/next/build/webpack/loaders/next-flight-server-loader.ts | @@ -1,6 +1,6 @@
import { parse } from '../../swc'
import { getRawPageExtensions } from '../../utils'
-import { buildExports, isEsmNodeType } from './utils'
+import { buildExports } from './utils'
const imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'avif']
@@ -42,16 +42,18 @@ async function parseModuleInfo({
... | true |
Other | vercel | next.js | 4bfcf8345c5c40271e2aecc72d34640fde3c44cc.json | enhance: detect ESM by ast type (#35627)
Simplify the esmodule detection. If there's any import/exprt usage, it will return `Module` in ast.type otherwise `Script` when `isModule` is set to `"unknown"` | packages/next/build/webpack/loaders/utils.ts | @@ -11,12 +11,3 @@ export function buildExports(moduleExports: any, isESM: boolean) {
})
return ret
}
-
-const esmNodeTypes = [
- 'ImportDeclaration',
- 'ExportDeclaration',
- 'ExportNamedDeclaration',
- 'ExportDefaultExpression',
- 'ExportDefaultDeclaration',
-]
-export const isEsmNodeType = (type: string)... | true |
Other | vercel | next.js | 0d401ddcb58b6b602c0ff7098893c91f973b99d2.json | Fix typo in rewrites docs (#35639)
Correct the type of `trailingSlash` in config example
Modified: `docs/api-reference/next.config.js/rewrites.md`
```diff
- trailingSlash: 'true',
+ trailingSlash: true,
``` | docs/api-reference/next.config.js/rewrites.md | @@ -327,7 +327,7 @@ If you're using `trailingSlash: true`, you also need to insert a trailing slash
```js
module.exports = {
- trailingSlash: 'true',
+ trailingSlash: true,
async rewrites() {
return [
{ | false |
Other | vercel | next.js | d5e122594da9d6936c0c92cd59a20b6f6eff1fb0.json | Update rsc refresh typing and doc example (#35543)
* Update rsc refresh typing and doc example
* Update docs/api-reference/next/streaming.md
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: Shu Ding <g@shud.in> | docs/api-reference/next/streaming.md | @@ -88,6 +88,8 @@ export default function Search() {
<SearchUI
onChange={() => {
refresh()
+ // Or refresh with updated props:
+ // refresh(nextProps)
}}
/>
) | true |
Other | vercel | next.js | d5e122594da9d6936c0c92cd59a20b6f6eff1fb0.json | Update rsc refresh typing and doc example (#35543)
* Update rsc refresh typing and doc example
* Update docs/api-reference/next/streaming.md
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: Shu Ding <g@shud.in> | packages/next/client/index.tsx | @@ -808,7 +808,7 @@ if (process.env.__NEXT_RSC) {
const startTransition = (React as any).startTransition
const rerender = () => dispatch({})
// If there is no cache, or there is serialized data already
- function refreshCache(nextProps: any) {
+ function refreshCache(nextProps?: any) {
start... | true |
Other | vercel | next.js | d5e122594da9d6936c0c92cd59a20b6f6eff1fb0.json | Update rsc refresh typing and doc example (#35543)
* Update rsc refresh typing and doc example
* Update docs/api-reference/next/streaming.md
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: Shu Ding <g@shud.in> | packages/next/client/streaming/refresh.ts | @@ -1,6 +1,6 @@
import { createContext, useContext } from 'react'
-export const RefreshContext = createContext((_: any) => {})
+export const RefreshContext = createContext((_props?: any) => {})
export function useRefreshRoot() {
return useContext(RefreshContext) | true |
Other | vercel | next.js | 4e8e191a6e6520aca82e32e108f1f5ae6146b577.json | RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs ... | packages/next/build/webpack/loaders/next-flight-client-loader.ts | @@ -6,6 +6,7 @@
*/
import { parse } from '../../swc'
+import { buildExports } from './utils'
function addExportNames(names: string[], node: any) {
switch (node.type) {
@@ -39,7 +40,7 @@ function addExportNames(names: string[], node: any) {
}
}
-async function parseExportNamesInto(
+async function parse... | true |
Other | vercel | next.js | 4e8e191a6e6520aca82e32e108f1f5ae6146b577.json | RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs ... | packages/next/build/webpack/loaders/next-flight-server-loader.ts | @@ -1,5 +1,6 @@
import { parse } from '../../swc'
import { getRawPageExtensions } from '../../utils'
+import { buildExports, isEsmNodeType } from './utils'
const imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'avif']
@@ -24,7 +25,7 @@ const createServerComponentFilter = (pageExtensions: string[]) => {
retur... | true |
Other | vercel | next.js | 4e8e191a6e6520aca82e32e108f1f5ae6146b577.json | RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs ... | packages/next/build/webpack/loaders/utils.ts | @@ -0,0 +1,21 @@
+export function buildExports(moduleExports: any, isESM: boolean) {
+ let ret = ''
+ Object.keys(moduleExports).forEach((key) => {
+ const exportExpression = isESM
+ ? `export ${key === 'default' ? key : `const ${key} =`} ${
+ moduleExports[key]
+ }`
+ : `exports.${key} =... | true |
Other | vercel | next.js | 4e8e191a6e6520aca82e32e108f1f5ae6146b577.json | RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs ... | test/integration/react-streaming-and-server-components/app/components/cjs.client.js | @@ -0,0 +1,3 @@
+exports.Cjs = function Cjs() {
+ return 'cjs-client'
+} | true |
Other | vercel | next.js | 4e8e191a6e6520aca82e32e108f1f5ae6146b577.json | RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs ... | test/integration/react-streaming-and-server-components/app/components/cjs.js | @@ -0,0 +1,3 @@
+exports.Cjs = function Cjs() {
+ return 'cjs-shared'
+} | true |
Other | vercel | next.js | 4e8e191a6e6520aca82e32e108f1f5ae6146b577.json | RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs ... | test/integration/react-streaming-and-server-components/app/pages/various-exports.server.js | @@ -4,6 +4,8 @@ import { a, b, c, d, e } from '../components/shared-exports'
import DefaultArrow, {
Named as ClientNamed,
} from '../components/client-exports.client'
+import { Cjs as CjsShared } from '../components/cjs'
+import { Cjs as CjsClient } from '../components/cjs.client'
export default function Page()... | true |
Other | vercel | next.js | 4e8e191a6e6520aca82e32e108f1f5ae6146b577.json | RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs ... | test/integration/react-streaming-and-server-components/test/rsc.js | @@ -206,6 +206,8 @@ export default function (context, { runtime, env }) {
expect(hydratedContent).toContain('abcde')
expect(hydratedContent).toContain('default-export-arrow.client')
expect(hydratedContent).toContain('named.client')
+ expect(hydratedContent).toContain('cjs-shared')
+ expect(hydrated... | true |
Other | vercel | next.js | f16ee05f599de27e777ac2b736c3bf820a19bd7b.json | Fix typo in docs (#35561)
The following files have been modified.
- `docs/api-reference/next.config.js/rewrites.md`
- `docs/basic-features/script.md`
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint` | docs/api-reference/next.config.js/rewrites.md | @@ -323,7 +323,7 @@ module.exports = {
}
```
-If you're using `trailingSlash: true`, you also need to insert a trailing slash in the `source` paramater. If the destination server is also expecting a trailing slash it should be included in the `destination` parameter as well.
+If you're using `trailingSlash: true`, ... | true |
Other | vercel | next.js | f16ee05f599de27e777ac2b736c3bf820a19bd7b.json | Fix typo in docs (#35561)
The following files have been modified.
- `docs/api-reference/next.config.js/rewrites.md`
- `docs/basic-features/script.md`
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint` | docs/basic-features/script.md | @@ -166,7 +166,7 @@ There are a number of trade-offs that need to be considered when loading a third
Although the `worker` strategy does not require any additional configuration to work, Partytown supports the use of a config object to modify some of its settings, including enabling `debug` mode and forwarding event... | true |
Other | vercel | next.js | 432261a1e15b253b8a56be42cc3698a4d7bdf513.json | Add link for revalidate from notFound section (#35553) | docs/api-reference/data-fetching/get-static-props.md | @@ -85,7 +85,7 @@ Learn more about [Incremental Static Regeneration](/docs/basic-features/data-fet
### `notFound`
-The `notFound` boolean allows the page to return a `404` status and [404 Page](/docs/advanced-features/custom-error-page.md#404-page). With `notFound: true`, the page will return a `404` even if there... | false |
Other | vercel | next.js | c261924756484255caecc756af9760707548c929.json | feat(telemetry): report swc target triple to telemetry (#35420) | packages/next/build/swc/index.js | @@ -76,6 +76,9 @@ async function loadWasm() {
parse(src, options) {
return Promise.resolve(bindings.parse(src.toString(), options))
},
+ getTargetTriple() {
+ return undefined
+ },
}
return wasmBindings
} catch (e) {
@@ -187,6 +190,8 @@ function loa... | true |
Other | vercel | next.js | c261924756484255caecc756af9760707548c929.json | feat(telemetry): report swc target triple to telemetry (#35420) | packages/next/build/webpack-config.ts | @@ -43,7 +43,11 @@ import { WellKnownErrorsPlugin } from './webpack/plugins/wellknown-errors-plugin
import { regexLikeCss } from './webpack/config/blocks/css'
import { CopyFilePlugin } from './webpack/plugins/copy-file-plugin'
import { FlightManifestPlugin } from './webpack/plugins/flight-manifest-plugin'
-import { ... | true |
Other | vercel | next.js | c261924756484255caecc756af9760707548c929.json | feat(telemetry): report swc target triple to telemetry (#35420) | packages/next/build/webpack/plugins/telemetry-plugin.ts | @@ -1,6 +1,24 @@
import type { webpack5 as webpack } from 'next/dist/compiled/webpack/webpack'
-type Feature =
+/**
+ * List of target triples next-swc native binary supports.
+ */
+export type SWC_TARGET_TRIPLE =
+ | 'x86_64-apple-darwin'
+ | 'x86_64-unknown-linux-gnu'
+ | 'x86_64-pc-windows-msvc'
+ | 'i686-pc-... | true |
Other | vercel | next.js | c261924756484255caecc756af9760707548c929.json | feat(telemetry): report swc target triple to telemetry (#35420) | packages/next/telemetry/events/build.ts | @@ -1,4 +1,5 @@
import { TelemetryPlugin } from '../../build/webpack/plugins/telemetry-plugin'
+import type { SWC_TARGET_TRIPLE } from '../../build/webpack/plugins/telemetry-plugin'
const REGEXP_DIRECTORY_DUNDER =
/[\\/]__[^\\/]+(?<![\\/]__(?:tests|mocks))__[\\/]/i
@@ -144,6 +145,7 @@ export type EventBuildFeatu... | true |
Other | vercel | next.js | c261924756484255caecc756af9760707548c929.json | feat(telemetry): report swc target triple to telemetry (#35420) | test/integration/telemetry/test/index.test.js | @@ -632,6 +632,19 @@ describe('Telemetry CLI', () => {
regex.exec(stderr).pop() // swcRemoveConsole
regex.exec(stderr).pop() // swcImportSource
regex.exec(stderr).pop() // swcEmotion
+ regex.exec(stderr).pop() // swc/targets/*
+ regex.exec(stderr).pop()
+ regex.exec(stderr).pop()
+ regex.exec... | true |
Other | vercel | next.js | cd4798415259e932a18b91e883cb76f754067f0a.json | clarify use of Script (#35491)
Leave more clear that <Script> component can't be used inside Head. Current it says "without need", which don't implies it can't be used.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.... | docs/basic-features/script.md | @@ -25,7 +25,7 @@ description: Next.js helps you optimize loading third-party scripts with the bui
</details>
-The Next.js Script component, [`next/script`](/docs/api-reference/next/script.md), is an extension of the HTML `<script>` element. It enables developers to set the loading priority of third-party scripts ... | false |
Other | vercel | next.js | da3760bbf5544077a6ffa513c84030d0c0672a69.json | Use check on prerender test assertion (#35482) | test/e2e/prerender.test.ts | @@ -1922,11 +1922,15 @@ describe('Prerender', () => {
expect(res.status).toBe(200)
}
await next.deleteFile('error.txt')
- expect(
- next.cliOutput.match(
- /throwing error for \/blocking-fallback\/test-errors-1/
- ).length
- ).toBe(1)
+ awai... | false |
Other | vercel | next.js | 40a5c94ca76b317f1b8aa1a61e4d787db85b40e3.json | Fix typo in getServerSideProps doc page (#35467)
While reading the documentation, I noticed that this paragraph was not correctly written and was hard to read. I fixed it adding a dot.
## Documentation / Examples
- [ ] Make sure the linting passes by running `yarn lint` | docs/basic-features/data-fetching/get-server-side-props.md | @@ -21,7 +21,7 @@ export async function getServerSideProps(context) {
- When you request this page directly, `getServerSideProps` runs at request time, and this page will be pre-rendered with the returned props
- When you request this page on client-side page transitions through [`next/link`](/docs/api-reference/next... | false |
Other | vercel | next.js | 279f47b9caf32422f2a7239c905987774e30c11c.json | Keep fouc tags for streaming (#35417)
Basically the revert change of #31187
The fouc tag are rendered in first place, and the removing fouc tags script is executed before hydration which is early enough. This will unblock the dev mode of global CSS development
## Bug
- [x] Related issues linked using `fixes #number... | packages/next/pages/_document.tsx | @@ -585,11 +585,8 @@ export class Head extends Component<
disableOptimizedLoading,
optimizeCss,
optimizeFonts,
- runtime,
} = this.context
- const hasConcurrentFeatures = !!runtime
-
const disableRuntimeJS = unstable_runtimeJS === false
const disableJsPreload =
unsta... | true |
Other | vercel | next.js | 279f47b9caf32422f2a7239c905987774e30c11c.json | Keep fouc tags for streaming (#35417)
Basically the revert change of #31187
The fouc tag are rendered in first place, and the removing fouc tags script is executed before hydration which is early enough. This will unblock the dev mode of global CSS development
## Bug
- [x] Related issues linked using `fixes #number... | test/integration/react-streaming-and-server-components/test/css.js | @@ -16,8 +16,8 @@ export default function (context) {
)
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`)
})
- // TODO: fix this test
- it.skip('should include css modules with `serverComponents: true`', async () => {
+
+ it('should include css modules with `serverComponents: true`', async ... | true |
Other | vercel | next.js | 4365463fd92c7d17a4f112a8590e2fbc3d57b54a.json | Run tests against node LTS (v16) and current (v17) (#35414)
* Run tests against node LTS (v16) and current (v17)
* update pnp tests | .github/workflows/build_test_deploy.yml | @@ -208,12 +208,16 @@ jobs:
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
+ strategy:
+ fail-fast: false
+ matrix:
+ node: [16, 17]
steps:
- name: Setup node
uses: actions/setup-node@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
... | true |
Other | vercel | next.js | 4365463fd92c7d17a4f112a8590e2fbc3d57b54a.json | Run tests against node LTS (v16) and current (v17) (#35414)
* Run tests against node LTS (v16) and current (v17)
* update pnp tests | test/e2e/yarn-pnp/test/utils.ts | @@ -7,49 +7,54 @@ import { NextInstance } from 'test/lib/next-modes/base'
jest.setTimeout(2 * 60 * 1000)
export function runTests(example = '') {
- let next: NextInstance
+ const versionParts = process.versions.node.split('.').map((i) => Number(i))
- beforeAll(async () => {
- const srcDir = join(__dirname, ... | true |
Other | vercel | next.js | efdb87d134563c379807f96dcdc952f08125dd36.json | Drop browser field for edge runtime (#35335)
Related to #31678
For streaming pages,
Nodejs runtime: setting global runtime to `"nodejs"` will work with default module resolution.
Edge runtime: previously next.js will pick up browser field since it's the "similar" asset (unlike nodejs) to edge runtime but browser sp... | packages/next/build/webpack-config.ts | @@ -646,7 +646,9 @@ export default async function getBaseWebpackConfig(
},
}
: undefined),
- mainFields: !targetWeb ? ['main', 'module'] : ['browser', 'module', 'main'],
+ mainFields: targetWeb
+ ? (isEdgeRuntime ? [] : ['browser']).concat(['module', 'main'])
+ : ['main', 'mod... | true |
Other | vercel | next.js | efdb87d134563c379807f96dcdc952f08125dd36.json | Drop browser field for edge runtime (#35335)
Related to #31678
For streaming pages,
Nodejs runtime: setting global runtime to `"nodejs"` will work with default module resolution.
Edge runtime: previously next.js will pick up browser field since it's the "similar" asset (unlike nodejs) to edge runtime but browser sp... | test/integration/react-streaming-and-server-components/app/node_modules/non-isomorphic-text/browser.js | @@ -0,0 +1 @@
+export default () => 'browser-field-export' | true |
Other | vercel | next.js | efdb87d134563c379807f96dcdc952f08125dd36.json | Drop browser field for edge runtime (#35335)
Related to #31678
For streaming pages,
Nodejs runtime: setting global runtime to `"nodejs"` will work with default module resolution.
Edge runtime: previously next.js will pick up browser field since it's the "similar" asset (unlike nodejs) to edge runtime but browser sp... | test/integration/react-streaming-and-server-components/app/node_modules/non-isomorphic-text/index.js | @@ -0,0 +1 @@
+export default () => 'isomorphic-export' | true |
Other | vercel | next.js | efdb87d134563c379807f96dcdc952f08125dd36.json | Drop browser field for edge runtime (#35335)
Related to #31678
For streaming pages,
Nodejs runtime: setting global runtime to `"nodejs"` will work with default module resolution.
Edge runtime: previously next.js will pick up browser field since it's the "similar" asset (unlike nodejs) to edge runtime but browser sp... | test/integration/react-streaming-and-server-components/app/node_modules/non-isomorphic-text/package.json | @@ -0,0 +1,5 @@
+{
+ "name": "non-isomorphic-text",
+ "module": "./index.js",
+ "browser": "./browser.js"
+} | true |
Other | vercel | next.js | efdb87d134563c379807f96dcdc952f08125dd36.json | Drop browser field for edge runtime (#35335)
Related to #31678
For streaming pages,
Nodejs runtime: setting global runtime to `"nodejs"` will work with default module resolution.
Edge runtime: previously next.js will pick up browser field since it's the "similar" asset (unlike nodejs) to edge runtime but browser sp... | test/integration/react-streaming-and-server-components/app/pages/external-imports.server.js | @@ -1,5 +1,11 @@
import moment from 'moment'
+import nonIsomorphicText from 'non-isomorphic-text'
export default function Page() {
- return <div>date:{moment().toString()}</div>
+ return (
+ <div>
+ <div>date:{moment().toString()}</div>
+ <div>{nonIsomorphicText()}</div>
+ </div>
+ )
} | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.