-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix react packages are not bundled for metadata routes (#55579)
`isAppLayer` condition was missing `app-metadata-route` layer, made it as a util now like other webpack layer utils, add metadata route layer to the group. Then `React.cache` can be available there. Also update regex to be compatible across platform Fixes #55561 Closes NEXT-1635
- Loading branch information
Showing
6 changed files
with
68 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
test/e2e/app-dir/metadata-dynamic-routes/app/client-ref-dependency/client-component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
|
||
function ClientComponent() { | ||
const [state] = React.useState('component') | ||
return <div>{`client-` + state}</div> | ||
} | ||
|
||
export const clientRef = <ClientComponent /> |
16 changes: 16 additions & 0 deletions
16
test/e2e/app-dir/metadata-dynamic-routes/app/client-ref-dependency/sitemap.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
import { clientRef } from './client-component' | ||
|
||
export const contentType = 'image/png' | ||
const cachedNoop = React.cache(() => null) | ||
|
||
function noopCall(value) { | ||
return value | ||
} | ||
|
||
export default function sitemap() { | ||
// keep the variable from being tree-shaken | ||
noopCall(clientRef) | ||
cachedNoop() | ||
return [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters