{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n+ \n+ )\n+}\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/expected.ts b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/expected.ts\nnew file mode 100644\nindex 0000000000000..37ae1d80cd3d1\n--- /dev/null\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/expected.ts\n@@ -0,0 +1,9 @@\n+export type Params = {\n+ locale: string\n+ rest: string[]\n+}\n+\n+export const expectedParams: Params = {\n+ locale: 'en',\n+ rest: ['1', '2'],\n+}\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/middleware.ts b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/middleware.ts\nnew file mode 100644\nindex 0000000000000..d6cac831af0fb\n--- /dev/null\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/middleware.ts\n@@ -0,0 +1,21 @@\n+import type { NextRequest } from 'next/server'\n+import { NextResponse } from 'next/server'\n+\n+export function middleware(request: NextRequest) {\n+ return NextResponse.rewrite(\n+ new URL('/en' + request.nextUrl.pathname, request.url)\n+ )\n+}\n+\n+export const config = {\n+ matcher: [\n+ /*\n+ * Match all request paths except for the ones starting with:\n+ * - api (API routes)\n+ * - _next/static (static files)\n+ * - _next/image (image optimization files)\n+ * - favicon.ico, sitemap.xml, robots.txt (metadata files)\n+ */\n+ '/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',\n+ ],\n+}\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/next.config.js b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/next.config.js\nnew file mode 100644\nindex 0000000000000..016ac8833b57f\n--- /dev/null\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/next.config.js\n@@ -0,0 +1,10 @@\n+/**\n+ * @type {import('next').NextConfig}\n+ */\n+const nextConfig = {\n+ experimental: {\n+ ppr: true,\n+ },\n+}\n+\n+module.exports = nextConfig\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params.test.ts b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params.test.ts\nnew file mode 100644\nindex 0000000000000..4c583bbdf32c6\n--- /dev/null\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params.test.ts\n@@ -0,0 +1,26 @@\n+import { nextTestSetup } from 'e2e-utils'\n+import { expectedParams as expected } from './expected'\n+\n+describe('ppr-middleware-rewrite-force-dynamic-generate-static-params', () => {\n+ const { next } = nextTestSetup({\n+ files: __dirname,\n+ })\n+\n+ const expectedParams = JSON.stringify(expected)\n+\n+ it('should have correct dynamic params', async () => {\n+ // should be rewritten with /en\n+ const browser = await next.browser('/')\n+ expect(await browser.elementByCss('a').text()).toBe('Go to /1/2')\n+\n+ // navigate to /1/2\n+ await browser.elementByCss('a').click()\n+\n+ // should be rewritten with /en/1/2 with correct params\n+ expect(await browser.elementByCss('p').text()).toBe(expectedParams)\n+\n+ // reloading the page should have the same params\n+ await browser.refresh()\n+ expect(await browser.elementByCss('p').text()).toBe(expectedParams)\n+ })\n+})\n"},"modified_context":{"kind":"string","value":"diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts\nindex 598b6ce2bf122..2940d4e30feb0 100644\n--- a/packages/next/src/server/base-server.ts\n+++ b/packages/next/src/server/base-server.ts\n@@ -1131,6 +1131,8 @@ export default abstract class Server<\n matchedPath = this.normalize(matchedPath)\n const normalizedUrlPath = this.stripNextDataPath(urlPathname)\n+ matchedPath = denormalizePagePath(matchedPath)\n // Perform locale detection and normalization.\n const localeAnalysisResult = this.i18nProvider?.analyze(matchedPath, {\n defaultLocale,\n@@ -1151,11 +1153,15 @@ export default abstract class Server<\n- // TODO: check if this is needed any more?\n- matchedPath = denormalizePagePath(matchedPath)\n-\n let srcPathname = matchedPath\n let pageIsDynamic = isDynamicRoute(srcPathname)\n+ let paramsResult: {\n+ params: ParsedUrlQuery | false\n+ hasValidParams: boolean\n+ } = {\n+ params: false,\n+ hasValidParams: false,\n+ }\n if (!pageIsDynamic) {\n const match = await this.matchers.match(srcPathname, {\n@@ -1165,8 +1171,15 @@ export default abstract class Server<\n // Update the source pathname to the matched page's pathname.\n if (match) {\n srcPathname = match.definition.pathname\n- pageIsDynamic = typeof match.params !== 'undefined'\n+ // The page is dynamic if the params are defined. We know at this\n+ // stage that the matched path is not a static page if the params\n+ // were parsed from the matched path header.\n+ if (typeof match.params !== 'undefined') {\n+ pageIsDynamic = true\n+ paramsResult.hasValidParams = true\n@@ -1236,10 +1249,14 @@ export default abstract class Server<\n if (pageIsDynamic) {\n let params: ParsedUrlQuery | false = {}\n- let paramsResult = utils.normalizeDynamicRouteParams(\n- queryParams,\n- false\n- )\n+ // If we don't already have valid params, try to parse them from\n+ // the query params.\n+ if (!paramsResult.hasValidParams) {\n+ paramsResult = utils.normalizeDynamicRouteParams(\n+ queryParams,\n+ )\n+ }\n // for prerendered ISR paths we attempt parsing the route\n // params from the URL directly as route-matches may not\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/[locale]/[...rest]/page.tsx b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/[locale]/[...rest]/page.tsx\nindex 0000000000000..8ed2439d837c4\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/[locale]/[...rest]/page.tsx\n@@ -0,0 +1,17 @@\n+import { type Params, expectedParams } from '../../../expected'\n+export default async function CatchAll({\n+ params,\n+}: {\n+ params: Promise\n+}) {\n+ const received = await params\n+export async function generateStaticParams(): Promise {\n+ return [expectedParams]\n+export const dynamic = 'force-dynamic'\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/[locale]/page.tsx b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/[locale]/page.tsx\nindex 0000000000000..33d03756335ee\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/[locale]/page.tsx\n@@ -0,0 +1,5 @@\n+import Link from 'next/link'\n+export default function Home() {\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/layout.tsx b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/layout.tsx\nindex 0000000000000..888614deda3ba\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/app/layout.tsx\n@@ -0,0 +1,8 @@\n+export default function Root({ children }: { children: ReactNode }) {\n+ return (\n+ \n+ {children}\n+ \ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/expected.ts b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/expected.ts\nindex 0000000000000..37ae1d80cd3d1\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/expected.ts\n@@ -0,0 +1,9 @@\n+export type Params = {\n+ rest: string[]\n+export const expectedParams: Params = {\n+ locale: 'en',\n+ rest: ['1', '2'],\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/middleware.ts b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/middleware.ts\nindex 0000000000000..d6cac831af0fb\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/middleware.ts\n@@ -0,0 +1,21 @@\n+import type { NextRequest } from 'next/server'\n+export function middleware(request: NextRequest) {\n+ return NextResponse.rewrite(\n+ new URL('/en' + request.nextUrl.pathname, request.url)\n+export const config = {\n+ matcher: [\n+ /*\n+ * - api (API routes)\n+ * - _next/static (static files)\n+ * - _next/image (image optimization files)\n+ * - favicon.ico, sitemap.xml, robots.txt (metadata files)\n+ */\n+ ],\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/next.config.js b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/next.config.js\nindex 0000000000000..016ac8833b57f\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/next.config.js\n@@ -0,0 +1,10 @@\n+/**\n+ * @type {import('next').NextConfig}\n+ */\n+const nextConfig = {\n+ experimental: {\n+ ppr: true,\n+ },\n+module.exports = nextConfig\ndiff --git a/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params.test.ts b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params.test.ts\nindex 0000000000000..4c583bbdf32c6\n+++ b/test/e2e/app-dir/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params/ppr-middleware-rewrite-force-dynamic-ssg-dynamic-params.test.ts\n@@ -0,0 +1,26 @@\n+import { nextTestSetup } from 'e2e-utils'\n+import { expectedParams as expected } from './expected'\n+describe('ppr-middleware-rewrite-force-dynamic-generate-static-params', () => {\n+ const { next } = nextTestSetup({\n+ files: __dirname,\n+ const expectedParams = JSON.stringify(expected)\n+ // should be rewritten with /en\n+ const browser = await next.browser('/')\n+ expect(await browser.elementByCss('a').text()).toBe('Go to /1/2')\n+ // navigate to /1/2\n+ await browser.elementByCss('a').click()\n+ // should be rewritten with /en/1/2 with correct params\n+ // reloading the page should have the same params\n+ await browser.refresh()"},"omitted_context":{"kind":"list like","value":["- // The page is dynamic if the params are defined.","+ paramsResult.params = match.params","+ }","+ false","+ return

{JSON.stringify(received)}

","+ return Go to /1/2","+import { ReactNode } from 'react'","+ locale: string","+import { NextResponse } from 'next/server'","+ * Match all request paths except for the ones starting with:","+ '/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',","+ it('should have correct dynamic params', async () => {","+})"],"string":"[\n \"- // The page is dynamic if the params are defined.\",\n \"+ paramsResult.params = match.params\",\n \"+ }\",\n \"+ false\",\n \"+ return

{JSON.stringify(received)}

\",\n \"+ return Go to /1/2\",\n \"+import { ReactNode } from 'react'\",\n \"+ locale: string\",\n \"+import { NextResponse } from 'next/server'\",\n \"+ * Match all request paths except for the ones starting with:\",\n \"+ '/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',\",\n \"+ it('should have correct dynamic params', async () => {\",\n \"+})\"\n]"},"omitted_index":{"kind":"list like","value":[36,44,46,63,84,101,109,124,139,150,156,191,206],"string":"[\n 36,\n 44,\n 46,\n 63,\n 84,\n 101,\n 109,\n 124,\n 139,\n 150,\n 156,\n 191,\n 206\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 122,\n \"author\": \"wyattjoh\",\n \"deletions\": 9,\n \"html_url\": \"https://github.com/vercel/next.js/pull/77994\",\n \"issue_id\": 77994,\n \"merged_at\": \"2025-04-10T14:47:41Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 77994,\n \"repo\": \"vercel/next.js\",\n \"title\": \"fix: use the match result after matching using the matched path header\",\n \"total_changes\": 131\n}"}}},{"rowIdx":315,"cells":{"id":{"kind":"number","value":315,"string":"315"},"original_context":{"kind":"string","value":"diff --git a/turbopack/crates/turbopack-core/src/module_graph/mod.rs b/turbopack/crates/turbopack-core/src/module_graph/mod.rs\nindex 5bf545577c9c7..4a89cc48d1f5b 100644\n--- a/turbopack/crates/turbopack-core/src/module_graph/mod.rs\n+++ b/turbopack/crates/turbopack-core/src/module_graph/mod.rs\n@@ -325,6 +325,21 @@ impl SingleModuleGraph {\n \n graph.shrink_to_fit();\n \n+ #[cfg(debug_assertions)]\n+ {\n+ let mut duplicates = Vec::new();\n+ let mut set = FxHashSet::default();\n+ for &module in modules.keys() {\n+ let ident = module.ident().to_string().await?;\n+ if !set.insert(ident.clone()) {\n+ duplicates.push(ident);\n+ }\n+ }\n+ if !duplicates.is_empty() {\n+ panic!(\"Duplicate module idents in graph: {:#?}\", duplicates);\n+ }\n+ }\n+\n Ok(SingleModuleGraph {\n graph: TracedDiGraph::new(graph),\n number_of_modules,\n"},"modified_context":{"kind":"string","value":"diff --git a/turbopack/crates/turbopack-core/src/module_graph/mod.rs b/turbopack/crates/turbopack-core/src/module_graph/mod.rs\nindex 5bf545577c9c7..4a89cc48d1f5b 100644\n--- a/turbopack/crates/turbopack-core/src/module_graph/mod.rs\n+++ b/turbopack/crates/turbopack-core/src/module_graph/mod.rs\n@@ -325,6 +325,21 @@ impl SingleModuleGraph {\n graph.shrink_to_fit();\n+ #[cfg(debug_assertions)]\n+ {\n+ let mut duplicates = Vec::new();\n+ let mut set = FxHashSet::default();\n+ for &module in modules.keys() {\n+ let ident = module.ident().to_string().await?;\n+ if !set.insert(ident.clone()) {\n+ duplicates.push(ident);\n+ }\n+ if !duplicates.is_empty() {\n+ }\n+\n Ok(SingleModuleGraph {\n graph: TracedDiGraph::new(graph),\n number_of_modules,"},"omitted_context":{"kind":"list like","value":["+ panic!(\"Duplicate module idents in graph: {:#?}\", duplicates);"],"string":"[\n \"+ panic!(\\\"Duplicate module idents in graph: {:#?}\\\", duplicates);\"\n]"},"omitted_index":{"kind":"list like","value":[19],"string":"[\n 19\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 15,\n \"author\": \"sokra\",\n \"deletions\": 0,\n \"html_url\": \"https://github.com/vercel/next.js/pull/78025\",\n \"issue_id\": 78025,\n \"merged_at\": \"2025-04-10T15:23:25Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 78025,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Turbopack: add debug assertion to check for duplicate modules\",\n \"total_changes\": 15\n}"}}},{"rowIdx":316,"cells":{"id":{"kind":"number","value":316,"string":"316"},"original_context":{"kind":"string","value":"diff --git a/test/e2e/app-dir/worker/app/string/page.js b/test/e2e/app-dir/worker/app/string/page.js\nnew file mode 100644\nindex 0000000000000..ba9f0a9795f38\n--- /dev/null\n+++ b/test/e2e/app-dir/worker/app/string/page.js\n@@ -0,0 +1,22 @@\n+'use client'\n+import { useState } from 'react'\n+\n+export default function Home() {\n+ const [state, setState] = useState('default')\n+ return (\n+
\n+ {\n+ const worker = new Worker('/unbundled-worker.js')\n+ worker.addEventListener('message', (event) => {\n+ setState(event.data)\n+ })\n+ }}\n+ >\n+ Get web worker data\n+ \n+

Worker state:

\n+

{state}

\n+
\n+ )\n+}\ndiff --git a/test/e2e/app-dir/worker/public/unbundled-worker.js b/test/e2e/app-dir/worker/public/unbundled-worker.js\nnew file mode 100644\nindex 0000000000000..50de186169b44\n--- /dev/null\n+++ b/test/e2e/app-dir/worker/public/unbundled-worker.js\n@@ -0,0 +1 @@\n+self.postMessage('unbundled-worker')\ndiff --git a/test/e2e/app-dir/worker/worker.test.ts b/test/e2e/app-dir/worker/worker.test.ts\nindex d6674b372acd2..aa4bd25edf7d1 100644\n--- a/test/e2e/app-dir/worker/worker.test.ts\n+++ b/test/e2e/app-dir/worker/worker.test.ts\n@@ -1,5 +1,5 @@\n import { nextTestSetup } from 'e2e-utils'\n-import { check } from 'next-test-utils'\n+import { retry } from 'next-test-utils'\n \n describe('app dir - workers', () => {\n const { next, skipped } = nextTestSetup({\n@@ -17,9 +17,10 @@ describe('app dir - workers', () => {\n \n await browser.elementByCss('button').click()\n \n- await check(\n- async () => browser.elementByCss('#worker-state').text(),\n- 'worker.ts:worker-dep'\n+ await retry(async () =>\n+ expect(await browser.elementByCss('#worker-state').text()).toBe(\n+ 'worker.ts:worker-dep'\n+ )\n )\n })\n \n@@ -29,9 +30,23 @@ describe('app dir - workers', () => {\n \n await browser.elementByCss('button').click()\n \n- await check(\n- async () => browser.elementByCss('#worker-state').text(),\n- 'worker.ts:worker-dep'\n+ await retry(async () =>\n+ expect(await browser.elementByCss('#worker-state').text()).toBe(\n+ 'worker.ts:worker-dep'\n+ )\n+ )\n+ })\n+\n+ it('should not bundle web workers with string specifiers', async () => {\n+ const browser = await next.browser('/string')\n+ expect(await browser.elementByCss('#worker-state').text()).toBe('default')\n+\n+ await browser.elementByCss('button').click()\n+\n+ await retry(async () =>\n+ expect(await browser.elementByCss('#worker-state').text()).toBe(\n+ 'unbundled-worker'\n+ )\n )\n })\n })\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs\nindex 59a50d22ac969..99575c4c7b2db 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs\n@@ -1641,14 +1641,7 @@ async fn handle_call) + Send + Sync>(\n \n return Ok(());\n }\n- let (args, hints) = explain_args(&args);\n- handler.span_warn_with_code(\n- span,\n- &format!(\"new Worker({args}) is not statically analyse-able{hints}\",),\n- DiagnosticId::Error(\n- errors::failed_to_analyse::ecmascript::DYNAMIC_IMPORT.to_string(),\n- ),\n- );\n+ // Ignore (e.g. dynamic parameter or string literal), just as Webpack does\n return Ok(());\n }\n _ => {}\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs\nnew file mode 100644\nindex 0000000000000..2dfd34db8c102\n--- /dev/null\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs\n@@ -0,0 +1,2 @@\n+// Shouldn't cause a worker to be created, but will still be pulled in by `new URL()`\n+module.exports = 123\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\nindex be07538408e45..f92a4088c8a18 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\n@@ -11,9 +11,8 @@ import(/* turbopackIgnore: true */ \"./ignore.mjs\");\n require(/* webpackIgnore: true */ \"./ignore.cjs\");\n require(/* turbopackIgnore: true */ \"./ignore.cjs\");\n \n-// and for workers\n-new Worker(/* webpackIgnore: true */ \"./ignore.mjs\");\n-new Worker(/* turbopackIgnore: true */ \"./ignore.cjs\");\n+new Worker(/* turbopackIgnore: true */ new URL(\"./ignore-worker.cjs\", import.meta.url))\n+new Worker(/* webpackIgnore: true */ new URL(\"./ignore-worker.cjs\", import.meta.url))\n \n export function foo(plugin) {\n return require(/* turbopackIgnore: true */ plugin)\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\nsimilarity index 97%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\nindex 0e788ecb48d5f..e6b674c0d17b7 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\n@@ -1,4 +1,4 @@\n-(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\", {\n+(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\", {\n \n \"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/vercel.mjs [test] (ecmascript, async loader)\": ((__turbopack_context__) => {\n \ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js.map\nsimilarity index 100%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js.map\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js.map\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\nsimilarity index 78%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\nindex 84eebf6c3bab8..7c4ff91fee634 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\n@@ -1,4 +1,4 @@\n-(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\", {\n+(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\", {\n \n \"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/vercel.cjs [test] (ecmascript)\": (function(__turbopack_context__) {\n \n@@ -20,6 +20,11 @@ __turbopack_context__.v(__turbopack_context__.b([\n \"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_cjs_3041f295._.js\"\n ]));\n }}),\n+\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs (static in ecmascript)\": ((__turbopack_context__) => {\n+\n+var { g: global, __dirname } = __turbopack_context__;\n+{\n+__turbopack_context__.v(\"/static/ignore-worker.c7cb9893.cjs\");}}),\n \"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js [test] (ecmascript)\": ((__turbopack_context__) => {\n \"use strict\";\n \n@@ -43,13 +48,12 @@ import(/* turbopackIgnore: true */ \"./ignore.mjs\");\n // this should work for cjs requires too\n require(/* webpackIgnore: true */ \"./ignore.cjs\");\n require(/* turbopackIgnore: true */ \"./ignore.cjs\");\n-// and for workers\n-new Worker(/* webpackIgnore: true */ \"./ignore.mjs\");\n-new Worker(/* turbopackIgnore: true */ \"./ignore.cjs\");\n+new Worker(new __turbopack_context__.U(__turbopack_context__.r(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs (static in ecmascript)\")));\n+new Worker(new __turbopack_context__.U(__turbopack_context__.r(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs (static in ecmascript)\")));\n function foo(plugin) {\n return require(/* turbopackIgnore: true */ plugin);\n }\n }}),\n }]);\n \n-//# sourceMappingURL=4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map\n\\ No newline at end of file\n+//# sourceMappingURL=4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\n\\ No newline at end of file\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\nsimilarity index 59%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\nindex e4b4b27f5d280..0bb350528d36d 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\n@@ -3,5 +3,5 @@\n \"sources\": [],\n \"sections\": [\n {\"offset\": {\"line\": 6, \"column\": 0}, \"map\": {\"version\":3,\"sources\":[\"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/vercel.cjs\"],\"sourcesContent\":[\"module.exports = \\\"turbopack\\\";\\n\"],\"names\":[],\"mappings\":\"AAAA,OAAO,OAAO,GAAG\"}},\n- {\"offset\": {\"line\": 27, \"column\": 0}, \"map\": {\"version\":3,\"sources\":[\"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\"],\"sourcesContent\":[\"import(\\\"./vercel.mjs\\\").then(console.log);\\nimport(/* webpackIgnore: false */ \\\"./vercel.mjs\\\").then(console.log);\\nconsole.log(require(\\\"./vercel.cjs\\\"));\\nnew Worker(/* turbopackIgnore: false */ new URL(\\\"./vercel.cjs\\\", import.meta.url));\\n\\n// turbopack shouldn't attempt to bundle these, and they should be preserved in the output\\nimport(/* webpackIgnore: true */ \\\"./ignore.mjs\\\");\\nimport(/* turbopackIgnore: true */ \\\"./ignore.mjs\\\");\\n\\n// this should work for cjs requires too\\nrequire(/* webpackIgnore: true */ \\\"./ignore.cjs\\\");\\nrequire(/* turbopackIgnore: true */ \\\"./ignore.cjs\\\");\\n\\n// and for workers\\nnew Worker(/* webpackIgnore: true */ \\\"./ignore.mjs\\\");\\nnew Worker(/* turbopackIgnore: true */ \\\"./ignore.cjs\\\");\\n\\nexport function foo(plugin) {\\n return require(/* turbopackIgnore: true */ plugin)\\n}\\n\"],\"names\":[],\"mappings\":\";;;;;;;;AAAA,yLAAuB,IAAI,CAAC,QAAQ,GAAG;AACvC,yLAAkD,IAAI,CAAC,QAAQ,GAAG;AAClE,QAAQ,GAAG;AACX,IAAI;AAEJ,0FAA0F;AAC1F,MAAM,CAAC,uBAAuB,GAAG;AACjC,MAAM,CAAC,yBAAyB,GAAG;AAEnC,wCAAwC;AACxC,QAAQ,uBAAuB,GAAG;AAClC,QAAQ,yBAAyB,GAAG;AAEpC,kBAAkB;AAClB,IAAI,OAAO,uBAAuB,GAAG;AACrC,IAAI,OAAO,yBAAyB,GAAG;AAEhC,SAAS,IAAI,MAAM;IACxB,OAAO,QAAQ,yBAAyB,GAAG;AAC7C\"}}]\n+ {\"offset\": {\"line\": 32, \"column\": 0}, \"map\": {\"version\":3,\"sources\":[\"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\"],\"sourcesContent\":[\"import(\\\"./vercel.mjs\\\").then(console.log);\\nimport(/* webpackIgnore: false */ \\\"./vercel.mjs\\\").then(console.log);\\nconsole.log(require(\\\"./vercel.cjs\\\"));\\nnew Worker(/* turbopackIgnore: false */ new URL(\\\"./vercel.cjs\\\", import.meta.url));\\n\\n// turbopack shouldn't attempt to bundle these, and they should be preserved in the output\\nimport(/* webpackIgnore: true */ \\\"./ignore.mjs\\\");\\nimport(/* turbopackIgnore: true */ \\\"./ignore.mjs\\\");\\n\\n// this should work for cjs requires too\\nrequire(/* webpackIgnore: true */ \\\"./ignore.cjs\\\");\\nrequire(/* turbopackIgnore: true */ \\\"./ignore.cjs\\\");\\n\\nnew Worker(/* turbopackIgnore: true */ new URL(\\\"./ignore-worker.cjs\\\", import.meta.url))\\nnew Worker(/* webpackIgnore: true */ new URL(\\\"./ignore-worker.cjs\\\", import.meta.url))\\n\\nexport function foo(plugin) {\\n return require(/* turbopackIgnore: true */ plugin)\\n}\\n\"],\"names\":[],\"mappings\":\";;;;;;;;AAAA,yLAAuB,IAAI,CAAC,QAAQ,GAAG;AACvC,yLAAkD,IAAI,CAAC,QAAQ,GAAG;AAClE,QAAQ,GAAG;AACX,IAAI;AAEJ,0FAA0F;AAC1F,MAAM,CAAC,uBAAuB,GAAG;AACjC,MAAM,CAAC,yBAAyB,GAAG;AAEnC,wCAAwC;AACxC,QAAQ,uBAAuB,GAAG;AAClC,QAAQ,yBAAyB,GAAG;AAEpC,IAAI;AACJ,IAAI;AAEG,SAAS,IAAI,MAAM;IACxB,OAAO,QAAQ,yBAAyB,GAAG;AAC7C\"}}]\n }\n\\ No newline at end of file\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\nsimilarity index 57%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\nindex c7b89bd2ebbe7..2249b5ad7ff06 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\n@@ -1,6 +1,6 @@\n (globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\n- \"output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js\",\n+ \"output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\",\n {},\n- {\"otherChunks\":[\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\",\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\"],\"runtimeModuleIds\":[\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js [test] (ecmascript)\"]}\n+ {\"otherChunks\":[\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\",\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\"],\"runtimeModuleIds\":[\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js [test] (ecmascript)\"]}\n ]);\n // Dummy runtime\n\\ No newline at end of file\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js.map\nsimilarity index 100%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js.map\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js.map\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/static/ignore-worker.c7cb9893.cjs b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/static/ignore-worker.c7cb9893.cjs\nnew file mode 100644\nindex 0000000000000..de83f1419f091\n--- /dev/null\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/static/ignore-worker.c7cb9893.cjs\n@@ -0,0 +1,2 @@\n+// Shouldn't cause a worker to be created, but will still be pulled in by `new URL()`\n+module.exports = 123\n\\ No newline at end of file\n"},"modified_context":{"kind":"string","value":"diff --git a/test/e2e/app-dir/worker/app/string/page.js b/test/e2e/app-dir/worker/app/string/page.js\nindex 0000000000000..ba9f0a9795f38\n+++ b/test/e2e/app-dir/worker/app/string/page.js\n@@ -0,0 +1,22 @@\n+'use client'\n+import { useState } from 'react'\n+export default function Home() {\n+ const [state, setState] = useState('default')\n+ return (\n+
\n+ {\n+ const worker = new Worker('/unbundled-worker.js')\n+ worker.addEventListener('message', (event) => {\n+ setState(event.data)\n+ })\n+ }}\n+ >\n+ Get web worker data\n+ \n+

Worker state:

\n+
\n+ )\n+}\ndiff --git a/test/e2e/app-dir/worker/public/unbundled-worker.js b/test/e2e/app-dir/worker/public/unbundled-worker.js\nindex 0000000000000..50de186169b44\n+++ b/test/e2e/app-dir/worker/public/unbundled-worker.js\n@@ -0,0 +1 @@\n+self.postMessage('unbundled-worker')\ndiff --git a/test/e2e/app-dir/worker/worker.test.ts b/test/e2e/app-dir/worker/worker.test.ts\nindex d6674b372acd2..aa4bd25edf7d1 100644\n--- a/test/e2e/app-dir/worker/worker.test.ts\n+++ b/test/e2e/app-dir/worker/worker.test.ts\n@@ -1,5 +1,5 @@\n import { nextTestSetup } from 'e2e-utils'\n-import { check } from 'next-test-utils'\n+import { retry } from 'next-test-utils'\n describe('app dir - workers', () => {\n const { next, skipped } = nextTestSetup({\n@@ -17,9 +17,10 @@ describe('app dir - workers', () => {\n@@ -29,9 +30,23 @@ describe('app dir - workers', () => {\n+ )\n+ })\n+ it('should not bundle web workers with string specifiers', async () => {\n+ const browser = await next.browser('/string')\n+ expect(await browser.elementByCss('#worker-state').text()).toBe('default')\n+ await browser.elementByCss('button').click()\n })\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs\nindex 59a50d22ac969..99575c4c7b2db 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs\n@@ -1641,14 +1641,7 @@ async fn handle_call) + Send + Sync>(\n return Ok(());\n }\n- let (args, hints) = explain_args(&args);\n- handler.span_warn_with_code(\n- span,\n- &format!(\"new Worker({args}) is not statically analyse-able{hints}\",),\n- errors::failed_to_analyse::ecmascript::DYNAMIC_IMPORT.to_string(),\n- ),\n- );\n+ // Ignore (e.g. dynamic parameter or string literal), just as Webpack does\n return Ok(());\n }\n _ => {}\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs\nindex 0000000000000..2dfd34db8c102\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\nindex be07538408e45..f92a4088c8a18 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\n@@ -11,9 +11,8 @@ import(/* turbopackIgnore: true */ \"./ignore.mjs\");\n+new Worker(/* turbopackIgnore: true */ new URL(\"./ignore-worker.cjs\", import.meta.url))\n+new Worker(/* webpackIgnore: true */ new URL(\"./ignore-worker.cjs\", import.meta.url))\n export function foo(plugin) {\n return require(/* turbopackIgnore: true */ plugin)\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\nsimilarity index 97%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\nindex 0e788ecb48d5f..e6b674c0d17b7 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\n-(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\", {\n+(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\", {\n \"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/vercel.mjs [test] (ecmascript, async loader)\": ((__turbopack_context__) => {\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js.map\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js.map\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js.map\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\nsimilarity index 78%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\nindex 84eebf6c3bab8..7c4ff91fee634 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\n-(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\", {\n+(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\", {\n \"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/vercel.cjs [test] (ecmascript)\": (function(__turbopack_context__) {\n@@ -20,6 +20,11 @@ __turbopack_context__.v(__turbopack_context__.b([\n \"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_cjs_3041f295._.js\"\n ]));\n+\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/ignore-worker.cjs (static in ecmascript)\": ((__turbopack_context__) => {\n+var { g: global, __dirname } = __turbopack_context__;\n+{\n+__turbopack_context__.v(\"/static/ignore-worker.c7cb9893.cjs\");}}),\n \"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js [test] (ecmascript)\": ((__turbopack_context__) => {\n \"use strict\";\n@@ -43,13 +48,12 @@ import(/* turbopackIgnore: true */ \"./ignore.mjs\");\n // this should work for cjs requires too\n function foo(plugin) {\n return require(/* turbopackIgnore: true */ plugin);\n }]);\n-//# sourceMappingURL=4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map\n+//# sourceMappingURL=4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\nsimilarity index 59%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\nindex e4b4b27f5d280..0bb350528d36d 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js.map\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js.map\n@@ -3,5 +3,5 @@\n \"sources\": [],\n \"sections\": [\n {\"offset\": {\"line\": 6, \"column\": 0}, \"map\": {\"version\":3,\"sources\":[\"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/vercel.cjs\"],\"sourcesContent\":[\"module.exports = \\\"turbopack\\\";\\n\"],\"names\":[],\"mappings\":\"AAAA,OAAO,OAAO,GAAG\"}},\n- {\"offset\": {\"line\": 27, \"column\": 0}, \"map\": {\"version\":3,\"sources\":[\"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\"],\"sourcesContent\":[\"import(\\\"./vercel.mjs\\\").then(console.log);\\nimport(/* webpackIgnore: false */ \\\"./vercel.mjs\\\").then(console.log);\\nconsole.log(require(\\\"./vercel.cjs\\\"));\\nnew Worker(/* turbopackIgnore: false */ new URL(\\\"./vercel.cjs\\\", import.meta.url));\\n\\n// turbopack shouldn't attempt to bundle these, and they should be preserved in the output\\nimport(/* webpackIgnore: true */ \\\"./ignore.mjs\\\");\\nimport(/* turbopackIgnore: true */ \\\"./ignore.mjs\\\");\\n\\n// this should work for cjs requires too\\nrequire(/* webpackIgnore: true */ \\\"./ignore.cjs\\\");\\nrequire(/* turbopackIgnore: true */ \\\"./ignore.cjs\\\");\\n\\n// and for workers\\nnew Worker(/* webpackIgnore: true */ \\\"./ignore.mjs\\\");\\nnew Worker(/* turbopackIgnore: true */ \\\"./ignore.cjs\\\");\\n\\nexport function foo(plugin) {\\n return require(/* turbopackIgnore: true */ plugin)\\n}\\n\"],\"names\":[],\"mappings\":\";;;;;;;;AAAA,yLAAuB,IAAI,CAAC,QAAQ,GAAG;AACvC,yLAAkD,IAAI,CAAC,QAAQ,GAAG;AAClE,QAAQ,GAAG;AACX,IAAI;AAEJ,0FAA0F;AAC1F,MAAM,CAAC,uBAAuB,GAAG;AACjC,MAAM,CAAC,yBAAyB,GAAG;AAEnC,wCAAwC;AACxC,QAAQ,uBAAuB,GAAG;AAClC,QAAQ,yBAAyB,GAAG;AAEpC,kBAAkB;AAClB,IAAI,OAAO,uBAAuB,GAAG;AACrC,IAAI,OAAO,yBAAyB,GAAG;AAEhC,SAAS,IAAI,MAAM;IACxB,OAAO,QAAQ,yBAAyB,GAAG;AAC7C\"}}]\n+ {\"offset\": {\"line\": 32, \"column\": 0}, \"map\": {\"version\":3,\"sources\":[\"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js\"],\"sourcesContent\":[\"import(\\\"./vercel.mjs\\\").then(console.log);\\nimport(/* webpackIgnore: false */ \\\"./vercel.mjs\\\").then(console.log);\\nconsole.log(require(\\\"./vercel.cjs\\\"));\\nnew Worker(/* turbopackIgnore: false */ new URL(\\\"./vercel.cjs\\\", import.meta.url));\\n\\n// turbopack shouldn't attempt to bundle these, and they should be preserved in the output\\nimport(/* webpackIgnore: true */ \\\"./ignore.mjs\\\");\\nimport(/* turbopackIgnore: true */ \\\"./ignore.mjs\\\");\\n\\n// this should work for cjs requires too\\nrequire(/* webpackIgnore: true */ \\\"./ignore.cjs\\\");\\nrequire(/* turbopackIgnore: true */ \\\"./ignore.cjs\\\");\\n\\nnew Worker(/* turbopackIgnore: true */ new URL(\\\"./ignore-worker.cjs\\\", import.meta.url))\\nnew Worker(/* webpackIgnore: true */ new URL(\\\"./ignore-worker.cjs\\\", import.meta.url))\\n\\nexport function foo(plugin) {\\n return require(/* turbopackIgnore: true */ plugin)\\n}\\n\"],\"names\":[],\"mappings\":\";;;;;;;;AAAA,yLAAuB,IAAI,CAAC,QAAQ,GAAG;AACvC,yLAAkD,IAAI,CAAC,QAAQ,GAAG;AAClE,QAAQ,GAAG;AACX,IAAI;AAEJ,0FAA0F;AAC1F,MAAM,CAAC,uBAAuB,GAAG;AACjC,MAAM,CAAC,yBAAyB,GAAG;AAEnC,wCAAwC;AACxC,QAAQ,uBAAuB,GAAG;AAClC,QAAQ,yBAAyB,GAAG;AAEpC,IAAI;AACJ,IAAI;AAEG,SAAS,IAAI,MAAM;IACxB,OAAO,QAAQ,yBAAyB,GAAG;AAC7C\"}}]\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\nsimilarity index 57%\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\nindex c7b89bd2ebbe7..2249b5ad7ff06 100644\n--- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\n@@ -1,6 +1,6 @@\n (globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([\n- \"output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js\",\n+ \"output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js\",\n {},\n- {\"otherChunks\":[\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_f0a767e9._.js\",\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_e1849155._.js\"],\"runtimeModuleIds\":[\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js [test] (ecmascript)\"]}\n+ {\"otherChunks\":[\"output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_0dd84fce._.js\",\"output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js\"],\"runtimeModuleIds\":[\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/input/index.js [test] (ecmascript)\"]}\n ]);\n // Dummy runtime\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js.map\nrename from turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_03bfbde6.js.map\nrename to turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/b1abf_turbopack-tests_tests_snapshot_imports_ignore-comments_input_index_a67357ee.js.map\ndiff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/static/ignore-worker.c7cb9893.cjs b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/static/ignore-worker.c7cb9893.cjs\nindex 0000000000000..de83f1419f091\n+++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/static/ignore-worker.c7cb9893.cjs"},"omitted_context":{"kind":"list like","value":["+

{state}

","+ 'unbundled-worker'","- DiagnosticId::Error("],"string":"[\n \"+

{state}

\",\n \"+ 'unbundled-worker'\",\n \"- DiagnosticId::Error(\"\n]"},"omitted_index":{"kind":"list like","value":[24,82,99],"string":"[\n 24,\n 82,\n 99\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 65,\n \"author\": \"mischnic\",\n \"deletions\": 27,\n \"html_url\": \"https://github.com/vercel/next.js/pull/78010\",\n \"issue_id\": 78010,\n \"merged_at\": \"2025-04-10T19:27:28Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 78010,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Turbopack: bundle only `new Worker` with `new URL`\",\n \"total_changes\": 92\n}"}}},{"rowIdx":317,"cells":{"id":{"kind":"number","value":317,"string":"317"},"original_context":{"kind":"string","value":"diff --git a/Cargo.lock b/Cargo.lock\nindex ac6cfacff7a05..be4ebea6f3f80 100644\n--- a/Cargo.lock\n+++ b/Cargo.lock\n@@ -10145,6 +10145,7 @@ dependencies = [\n \"anyhow\",\n \"either\",\n \"flate2\",\n+ \"hashbrown 0.14.5\",\n \"indexmap 2.7.1\",\n \"itertools 0.10.5\",\n \"postcard\",\ndiff --git a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\nindex e003b024b4f5c..41998db9992d9 100644\n--- a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n@@ -1,4 +1,3 @@\n-#![feature(hash_raw_entry)]\n #![feature(hash_extract_if)]\n \n pub mod map;\ndiff --git a/turbopack/crates/turbopack-trace-server/Cargo.toml b/turbopack/crates/turbopack-trace-server/Cargo.toml\nindex 423133b510cc2..799dab84c7614 100644\n--- a/turbopack/crates/turbopack-trace-server/Cargo.toml\n+++ b/turbopack/crates/turbopack-trace-server/Cargo.toml\n@@ -15,6 +15,7 @@ bench = false\n anyhow = { workspace = true, features = [\"backtrace\"] }\n either = { workspace = true }\n flate2 = { version = \"1.0.28\" }\n+hashbrown = { workspace = true, features = [\"raw\"] }\n indexmap = { workspace = true, features = [\"serde\"] }\n itertools = { workspace = true }\n postcard = { workspace = true }\ndiff --git a/turbopack/crates/turbopack-trace-server/src/bottom_up.rs b/turbopack/crates/turbopack-trace-server/src/bottom_up.rs\nindex 26ebf157b88ee..76397fc0ea558 100644\n--- a/turbopack/crates/turbopack-trace-server/src/bottom_up.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/bottom_up.rs\n@@ -1,6 +1,6 @@\n use std::{env, sync::Arc};\n \n-use rustc_hash::FxHashMap;\n+use hashbrown::HashMap;\n \n use crate::{\n span::{SpanBottomUp, SpanIndex},\n@@ -10,7 +10,7 @@ use crate::{\n pub struct SpanBottomUpBuilder {\n // These values won't change after creation:\n pub self_spans: Vec,\n- pub children: FxHashMap,\n+ pub children: HashMap,\n pub example_span: SpanIndex,\n }\n \n@@ -18,7 +18,7 @@ impl SpanBottomUpBuilder {\n pub fn new(example_span: SpanIndex) -> Self {\n Self {\n self_spans: vec![],\n- children: FxHashMap::default(),\n+ children: HashMap::default(),\n example_span,\n }\n }\n@@ -42,7 +42,7 @@ pub fn build_bottom_up_graph<'a>(\n .ok()\n .and_then(|s| s.parse().ok())\n .unwrap_or(usize::MAX);\n- let mut roots = FxHashMap::default();\n+ let mut roots: HashMap = HashMap::default();\n \n // unfortunately there is a rustc bug that fails the typechecking here\n // when using Either. This error appears\ndiff --git a/turbopack/crates/turbopack-trace-server/src/lib.rs b/turbopack/crates/turbopack-trace-server/src/lib.rs\nindex 0afff5689eb13..ef164659a8a6e 100644\n--- a/turbopack/crates/turbopack-trace-server/src/lib.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/lib.rs\n@@ -1,5 +1,4 @@\n #![feature(iter_intersperse)]\n-#![feature(hash_raw_entry)]\n #![feature(box_patterns)]\n \n use std::{hash::BuildHasherDefault, path::PathBuf, sync::Arc};\ndiff --git a/turbopack/crates/turbopack-trace-server/src/main.rs b/turbopack/crates/turbopack-trace-server/src/main.rs\nindex 1cb04575731d3..6e49291fca768 100644\n--- a/turbopack/crates/turbopack-trace-server/src/main.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/main.rs\n@@ -1,5 +1,4 @@\n #![feature(iter_intersperse)]\n-#![feature(hash_raw_entry)]\n #![feature(box_patterns)]\n \n use std::{hash::BuildHasherDefault, sync::Arc};\ndiff --git a/turbopack/crates/turbopack-trace-server/src/span.rs b/turbopack/crates/turbopack-trace-server/src/span.rs\nindex 20d025862b3af..0cca4825fbb42 100644\n--- a/turbopack/crates/turbopack-trace-server/src/span.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/span.rs\n@@ -3,7 +3,7 @@ use std::{\n sync::{Arc, OnceLock},\n };\n \n-use rustc_hash::FxHashMap;\n+use hashbrown::HashMap;\n \n use crate::timestamp::Timestamp;\n \n@@ -64,7 +64,7 @@ pub struct SpanTimeData {\n pub struct SpanExtra {\n pub graph: OnceLock>,\n pub bottom_up: OnceLock>>,\n- pub search_index: OnceLock>>,\n+ pub search_index: OnceLock>>,\n }\n \n #[derive(Default)]\ndiff --git a/turbopack/crates/turbopack-trace-server/src/span_ref.rs b/turbopack/crates/turbopack-trace-server/src/span_ref.rs\nindex 300c0c15032cc..8f42f30527a70 100644\n--- a/turbopack/crates/turbopack-trace-server/src/span_ref.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/span_ref.rs\n@@ -5,8 +5,9 @@ use std::{\n vec,\n };\n \n+use hashbrown::HashMap;\n use rayon::iter::{IntoParallelRefIterator, ParallelIterator};\n-use rustc_hash::{FxHashMap, FxHashSet};\n+use rustc_hash::FxHashSet;\n \n use crate::{\n bottom_up::build_bottom_up_graph,\n@@ -414,9 +415,9 @@ impl<'a> SpanRef<'a> {\n })\n }\n \n- fn search_index(&self) -> &FxHashMap> {\n+ fn search_index(&self) -> &HashMap> {\n self.extra().search_index.get_or_init(|| {\n- let mut index: FxHashMap> = FxHashMap::default();\n+ let mut index: HashMap> = HashMap::default();\n let mut queue = VecDeque::with_capacity(8);\n queue.push_back(*self);\n while let Some(span) = queue.pop_front() {\n"},"modified_context":{"kind":"string","value":"diff --git a/Cargo.lock b/Cargo.lock\nindex ac6cfacff7a05..be4ebea6f3f80 100644\n--- a/Cargo.lock\n+++ b/Cargo.lock\n@@ -10145,6 +10145,7 @@ dependencies = [\n \"anyhow\",\n \"either\",\n \"flate2\",\n+ \"hashbrown 0.14.5\",\n \"indexmap 2.7.1\",\n \"itertools 0.10.5\",\n \"postcard\",\ndiff --git a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\nindex e003b024b4f5c..41998db9992d9 100644\n--- a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n@@ -1,4 +1,3 @@\n #![feature(hash_extract_if)]\n pub mod map;\ndiff --git a/turbopack/crates/turbopack-trace-server/Cargo.toml b/turbopack/crates/turbopack-trace-server/Cargo.toml\nindex 423133b510cc2..799dab84c7614 100644\n--- a/turbopack/crates/turbopack-trace-server/Cargo.toml\n+++ b/turbopack/crates/turbopack-trace-server/Cargo.toml\n@@ -15,6 +15,7 @@ bench = false\n anyhow = { workspace = true, features = [\"backtrace\"] }\n either = { workspace = true }\n flate2 = { version = \"1.0.28\" }\n+hashbrown = { workspace = true, features = [\"raw\"] }\n indexmap = { workspace = true, features = [\"serde\"] }\n itertools = { workspace = true }\n postcard = { workspace = true }\ndiff --git a/turbopack/crates/turbopack-trace-server/src/bottom_up.rs b/turbopack/crates/turbopack-trace-server/src/bottom_up.rs\nindex 26ebf157b88ee..76397fc0ea558 100644\n--- a/turbopack/crates/turbopack-trace-server/src/bottom_up.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/bottom_up.rs\n@@ -1,6 +1,6 @@\n use std::{env, sync::Arc};\n span::{SpanBottomUp, SpanIndex},\n@@ -10,7 +10,7 @@ use crate::{\n pub struct SpanBottomUpBuilder {\n // These values won't change after creation:\n pub self_spans: Vec,\n- pub children: FxHashMap,\n+ pub children: HashMap,\n pub example_span: SpanIndex,\n@@ -18,7 +18,7 @@ impl SpanBottomUpBuilder {\n pub fn new(example_span: SpanIndex) -> Self {\n Self {\n self_spans: vec![],\n- children: FxHashMap::default(),\n example_span,\n }\n@@ -42,7 +42,7 @@ pub fn build_bottom_up_graph<'a>(\n .ok()\n .and_then(|s| s.parse().ok())\n .unwrap_or(usize::MAX);\n+ let mut roots: HashMap = HashMap::default();\n // unfortunately there is a rustc bug that fails the typechecking here\n // when using Either. This error appears\ndiff --git a/turbopack/crates/turbopack-trace-server/src/lib.rs b/turbopack/crates/turbopack-trace-server/src/lib.rs\nindex 0afff5689eb13..ef164659a8a6e 100644\n--- a/turbopack/crates/turbopack-trace-server/src/lib.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/lib.rs\n use std::{hash::BuildHasherDefault, path::PathBuf, sync::Arc};\ndiff --git a/turbopack/crates/turbopack-trace-server/src/main.rs b/turbopack/crates/turbopack-trace-server/src/main.rs\nindex 1cb04575731d3..6e49291fca768 100644\n--- a/turbopack/crates/turbopack-trace-server/src/main.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/main.rs\n use std::{hash::BuildHasherDefault, sync::Arc};\ndiff --git a/turbopack/crates/turbopack-trace-server/src/span.rs b/turbopack/crates/turbopack-trace-server/src/span.rs\nindex 20d025862b3af..0cca4825fbb42 100644\n--- a/turbopack/crates/turbopack-trace-server/src/span.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/span.rs\n@@ -3,7 +3,7 @@ use std::{\n sync::{Arc, OnceLock},\n use crate::timestamp::Timestamp;\n@@ -64,7 +64,7 @@ pub struct SpanTimeData {\n pub struct SpanExtra {\n pub graph: OnceLock>,\n pub bottom_up: OnceLock>>,\n- pub search_index: OnceLock>>,\n+ pub search_index: OnceLock>>,\n #[derive(Default)]\ndiff --git a/turbopack/crates/turbopack-trace-server/src/span_ref.rs b/turbopack/crates/turbopack-trace-server/src/span_ref.rs\nindex 300c0c15032cc..8f42f30527a70 100644\n--- a/turbopack/crates/turbopack-trace-server/src/span_ref.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/span_ref.rs\n@@ -5,8 +5,9 @@ use std::{\n vec,\n use rayon::iter::{IntoParallelRefIterator, ParallelIterator};\n-use rustc_hash::{FxHashMap, FxHashSet};\n+use rustc_hash::FxHashSet;\n bottom_up::build_bottom_up_graph,\n@@ -414,9 +415,9 @@ impl<'a> SpanRef<'a> {\n })\n- fn search_index(&self) -> &FxHashMap> {\n+ fn search_index(&self) -> &HashMap> {\n self.extra().search_index.get_or_init(|| {\n- let mut index: FxHashMap> = FxHashMap::default();\n+ let mut index: HashMap> = HashMap::default();\n let mut queue = VecDeque::with_capacity(8);\n queue.push_back(*self);\n while let Some(span) = queue.pop_front() {"},"omitted_context":{"kind":"list like","value":["+ children: HashMap::default(),","- let mut roots = FxHashMap::default();"],"string":"[\n \"+ children: HashMap::default(),\",\n \"- let mut roots = FxHashMap::default();\"\n]"},"omitted_index":{"kind":"list like","value":[59,67],"string":"[\n 59,\n 67\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 12,\n \"author\": \"wbinnssmith\",\n \"deletions\": 12,\n \"html_url\": \"https://github.com/vercel/next.js/pull/78032\",\n \"issue_id\": 78032,\n \"merged_at\": \"2025-04-10T20:12:19Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 78032,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Turbopack: use hashbrown HashMaps instead of now-removed std raw entry api\",\n \"total_changes\": 24\n}"}}},{"rowIdx":318,"cells":{"id":{"kind":"number","value":318,"string":"318"},"original_context":{"kind":"string","value":"diff --git a/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs b/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs\nindex f877ba4245bff..6aa0ec2cb076c 100644\n--- a/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs\n+++ b/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs\n@@ -35,8 +35,8 @@ pub async fn get_swc_ecma_transform_rule_impl(\n plugin_configs: &[(RcStr, serde_json::Value)],\n enable_mdx_rs: bool,\n ) -> Result> {\n- use anyhow::{bail, Context};\n- use turbo_tasks::{TryJoinIterExt, Value};\n+ use anyhow::bail;\n+ use turbo_tasks::{TryFlatJoinIterExt, Value};\n use turbo_tasks_fs::FileContent;\n use turbopack::{resolve_options, resolve_options_context::ResolveOptionsContext};\n use turbopack_core::{\n@@ -78,30 +78,34 @@ pub async fn get_swc_ecma_transform_rule_impl(\n )\n .as_raw_module_result(),\n Value::new(ReferenceType::CommonJs(CommonJsReferenceSubType::Undefined)),\n+ // TODO proper error location\n *project_path,\n request,\n resolve_options,\n false,\n+ // TODO proper error location\n None,\n )\n .await?;\n- let plugin_module = plugin_wasm_module_resolve_result\n- .first_module()\n- .await?\n- .context(\"Expected to find module\")?;\n \n- let content = &*plugin_module.content().file_content().await?;\n+ let Some(plugin_module) = &*plugin_wasm_module_resolve_result.first_module().await?\n+ else {\n+ // Ignore unresolveable plugin modules, handle_resolve_error has already emitted an\n+ // issue.\n+ return Ok(None);\n+ };\n \n+ let content = &*plugin_module.content().file_content().await?;\n let FileContent::Content(file) = content else {\n bail!(\"Expected file content for plugin module\");\n };\n \n- Ok((\n+ Ok(Some((\n SwcPluginModule::new(name, file.content().to_bytes()?.to_vec()).resolved_cell(),\n config.clone(),\n- ))\n+ )))\n })\n- .try_join()\n+ .try_flat_join()\n .await?;\n \n Ok(Some(get_ecma_transform_rule(\ndiff --git a/test/e2e/swc-plugins/app/layout.js b/test/e2e/swc-plugins/app/layout.js\nnew file mode 100644\nindex 0000000000000..9342eed18c78f\n--- /dev/null\n+++ b/test/e2e/swc-plugins/app/layout.js\n@@ -0,0 +1,9 @@\n+import React from 'react'\n+\n+export default function RootLayout({ children }) {\n+ return (\n+ \n+ {children}\n+ \n+ )\n+}\ndiff --git a/test/e2e/swc-plugins/app/page.js b/test/e2e/swc-plugins/app/page.js\nnew file mode 100644\nindex 0000000000000..e5e30cce60408\n--- /dev/null\n+++ b/test/e2e/swc-plugins/app/page.js\n@@ -0,0 +1,5 @@\n+import React from 'react'\n+\n+export default function Page({ children }) {\n+ return
Hello World
\n+}\ndiff --git a/test/e2e/swc-plugins/index.test.ts b/test/e2e/swc-plugins/index.test.ts\nnew file mode 100644\nindex 0000000000000..8c5c70af08ebe\n--- /dev/null\n+++ b/test/e2e/swc-plugins/index.test.ts\n@@ -0,0 +1,58 @@\n+import { nextTestSetup, isNextDev } from 'e2e-utils'\n+\n+describe('swcPlugins', () => {\n+ describe('supports swcPlugins', () => {\n+ const { next, skipped } = nextTestSetup({\n+ files: __dirname,\n+ skipDeployment: true,\n+ dependencies: {\n+ '@swc/plugin-react-remove-properties': '7.0.2',\n+ },\n+ })\n+ if (skipped) return\n+\n+ it('basic case', async () => {\n+ const html = await next.render('/')\n+ expect(html).toContain('Hello World')\n+ expect(html).not.toContain('data-custom-attribute')\n+ })\n+ })\n+ ;(isNextDev ? describe : describe.skip)('invalid plugin name', () => {\n+ const { next, skipped, isTurbopack } = nextTestSetup({\n+ files: __dirname,\n+ skipDeployment: true,\n+ overrideFiles: {\n+ 'next.config.js': `\n+module.exports = {\n+ experimental: {\n+ swcPlugins: [['@swc/plugin-nonexistent', {}]],\n+ },\n+}`,\n+ },\n+ })\n+ if (skipped) return\n+\n+ it('shows a redbox in dev', async () => {\n+ const browser = await next.browser('/')\n+\n+ if (isTurbopack) {\n+ await expect(browser).toDisplayRedbox(`\n+ {\n+ \"description\": \"Module not found: Can't resolve '@swc/plugin-nonexistent'\",\n+ \"environmentLabel\": null,\n+ \"label\": \"Build Error\",\n+ \"source\": \"./\n+ Module not found: Can't resolve '@swc/plugin-nonexistent'\n+ https://nextjs.org/docs/messages/module-not-found\",\n+ \"stack\": [],\n+ }\n+ `)\n+ } else {\n+ // TODO missing proper error with Webpack\n+ await expect(browser).toDisplayRedbox(\n+ `\"Expected Redbox but found no visible one.\"`\n+ )\n+ }\n+ })\n+ })\n+})\ndiff --git a/test/e2e/swc-plugins/next.config.js b/test/e2e/swc-plugins/next.config.js\nnew file mode 100644\nindex 0000000000000..3acbf16005e7a\n--- /dev/null\n+++ b/test/e2e/swc-plugins/next.config.js\n@@ -0,0 +1,13 @@\n+/** @type {import('next').NextConfig} */\n+module.exports = {\n+ experimental: {\n+ swcPlugins: [\n+ [\n+ '@swc/plugin-react-remove-properties',\n+ {\n+ properties: ['^data-custom-attribute$'],\n+ },\n+ ],\n+ ],\n+ },\n+}\n"},"modified_context":{"kind":"string","value":"diff --git a/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs b/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs\nindex f877ba4245bff..6aa0ec2cb076c 100644\n--- a/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs\n+++ b/crates/next-core/src/next_shared/transforms/swc_ecma_transform_plugins.rs\n@@ -35,8 +35,8 @@ pub async fn get_swc_ecma_transform_rule_impl(\n plugin_configs: &[(RcStr, serde_json::Value)],\n enable_mdx_rs: bool,\n ) -> Result> {\n- use anyhow::{bail, Context};\n+ use anyhow::bail;\n+ use turbo_tasks::{TryFlatJoinIterExt, Value};\n use turbo_tasks_fs::FileContent;\n use turbopack::{resolve_options, resolve_options_context::ResolveOptionsContext};\n use turbopack_core::{\n@@ -78,30 +78,34 @@ pub async fn get_swc_ecma_transform_rule_impl(\n )\n .as_raw_module_result(),\n Value::new(ReferenceType::CommonJs(CommonJsReferenceSubType::Undefined)),\n *project_path,\n request,\n resolve_options,\n false,\n None,\n )\n .await?;\n- .first_module()\n- .await?\n- let content = &*plugin_module.content().file_content().await?;\n+ let Some(plugin_module) = &*plugin_wasm_module_resolve_result.first_module().await?\n+ else {\n+ // Ignore unresolveable plugin modules, handle_resolve_error has already emitted an\n+ // issue.\n+ return Ok(None);\n+ };\n+ let content = &*plugin_module.content().file_content().await?;\n let FileContent::Content(file) = content else {\n bail!(\"Expected file content for plugin module\");\n };\n- Ok((\n+ Ok(Some((\n SwcPluginModule::new(name, file.content().to_bytes()?.to_vec()).resolved_cell(),\n config.clone(),\n- ))\n+ )))\n })\n- .try_join()\n+ .try_flat_join()\n .await?;\n Ok(Some(get_ecma_transform_rule(\ndiff --git a/test/e2e/swc-plugins/app/layout.js b/test/e2e/swc-plugins/app/layout.js\nindex 0000000000000..9342eed18c78f\n+++ b/test/e2e/swc-plugins/app/layout.js\n@@ -0,0 +1,9 @@\n+export default function RootLayout({ children }) {\n+ return (\n+ {children}\n+ \n+ )\ndiff --git a/test/e2e/swc-plugins/app/page.js b/test/e2e/swc-plugins/app/page.js\nindex 0000000000000..e5e30cce60408\n+++ b/test/e2e/swc-plugins/app/page.js\n@@ -0,0 +1,5 @@\n+export default function Page({ children }) {\n+ return
Hello World
\ndiff --git a/test/e2e/swc-plugins/index.test.ts b/test/e2e/swc-plugins/index.test.ts\nindex 0000000000000..8c5c70af08ebe\n+++ b/test/e2e/swc-plugins/index.test.ts\n@@ -0,0 +1,58 @@\n+import { nextTestSetup, isNextDev } from 'e2e-utils'\n+describe('swcPlugins', () => {\n+ describe('supports swcPlugins', () => {\n+ const { next, skipped } = nextTestSetup({\n+ '@swc/plugin-react-remove-properties': '7.0.2',\n+ const html = await next.render('/')\n+ expect(html).toContain('Hello World')\n+ expect(html).not.toContain('data-custom-attribute')\n+ ;(isNextDev ? describe : describe.skip)('invalid plugin name', () => {\n+ const { next, skipped, isTurbopack } = nextTestSetup({\n+ overrideFiles: {\n+ 'next.config.js': `\n+ swcPlugins: [['@swc/plugin-nonexistent', {}]],\n+}`,\n+ it('shows a redbox in dev', async () => {\n+ const browser = await next.browser('/')\n+ if (isTurbopack) {\n+ await expect(browser).toDisplayRedbox(`\n+ {\n+ \"description\": \"Module not found: Can't resolve '@swc/plugin-nonexistent'\",\n+ \"environmentLabel\": null,\n+ \"label\": \"Build Error\",\n+ \"source\": \"./\n+ Module not found: Can't resolve '@swc/plugin-nonexistent'\n+ https://nextjs.org/docs/messages/module-not-found\",\n+ \"stack\": [],\n+ }\n+ `)\n+ } else {\n+ // TODO missing proper error with Webpack\n+ `\"Expected Redbox but found no visible one.\"`\n+ )\n+ }\ndiff --git a/test/e2e/swc-plugins/next.config.js b/test/e2e/swc-plugins/next.config.js\nindex 0000000000000..3acbf16005e7a\n+++ b/test/e2e/swc-plugins/next.config.js\n@@ -0,0 +1,13 @@\n+/** @type {import('next').NextConfig} */\n+ swcPlugins: [\n+ [\n+ '@swc/plugin-react-remove-properties',\n+ properties: ['^data-custom-attribute$'],\n+ },\n+ ],"},"omitted_context":{"kind":"list like","value":["- use turbo_tasks::{TryJoinIterExt, Value};","- let plugin_module = plugin_wasm_module_resolve_result","- .context(\"Expected to find module\")?;","+ ","+ dependencies: {","+ it('basic case', async () => {","+ await expect(browser).toDisplayRedbox(","+})","+ {","+ ],"],"string":"[\n \"- use turbo_tasks::{TryJoinIterExt, Value};\",\n \"- let plugin_module = plugin_wasm_module_resolve_result\",\n \"- .context(\\\"Expected to find module\\\")?;\",\n \"+ \",\n \"+ dependencies: {\",\n \"+ it('basic case', async () => {\",\n \"+ await expect(browser).toDisplayRedbox(\",\n \"+})\",\n \"+ {\",\n \"+ ],\"\n]"},"omitted_index":{"kind":"list like","value":[9,28,31,68,97,103,141,147,160,163],"string":"[\n 9,\n 28,\n 31,\n 68,\n 97,\n 103,\n 141,\n 147,\n 160,\n 163\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 99,\n \"author\": \"mischnic\",\n \"deletions\": 10,\n \"html_url\": \"https://github.com/vercel/next.js/pull/77990\",\n \"issue_id\": 77990,\n \"merged_at\": \"2025-04-10T20:17:24Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 77990,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Turbopack: proper error message for swcPlugins\",\n \"total_changes\": 109\n}"}}},{"rowIdx":319,"cells":{"id":{"kind":"number","value":319,"string":"319"},"original_context":{"kind":"string","value":"diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts\nindex df29672da0216..463d270953f4f 100644\n--- a/packages/next/src/server/config-schema.ts\n+++ b/packages/next/src/server/config-schema.ts\n@@ -390,6 +390,7 @@ export const configSchema: zod.ZodType = z.lazy(() =>\n prerenderEarlyExit: z.boolean().optional(),\n proxyTimeout: z.number().gte(0).optional(),\n routerBFCache: z.boolean().optional(),\n+ removeUnhandledRejectionListeners: z.boolean().optional(),\n scrollRestoration: z.boolean().optional(),\n sri: z\n .object({\ndiff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts\nindex 2837e6e28dee1..b975d18039f3c 100644\n--- a/packages/next/src/server/config-shared.ts\n+++ b/packages/next/src/server/config-shared.ts\n@@ -509,6 +509,16 @@ export interface ExperimentalConfig {\n */\n routerBFCache?: boolean\n \n+ /**\n+ * Uninstalls all \"unhandledRejection\" listeners from the global process so\n+ * that we can override the behavior, which in some runtimes is to exit the\n+ * process on an unhandled rejection.\n+ *\n+ * This is experimental until we've considered the impact in various\n+ * deployment environments.\n+ */\n+ removeUnhandledRejectionListeners?: boolean\n+\n serverActions?: {\n /**\n * Allows adjusting body parser size limit for server actions.\n@@ -1302,6 +1312,7 @@ export const defaultConfig: NextConfig = {\n useEarlyImport: false,\n viewTransition: false,\n routerBFCache: false,\n+ removeUnhandledRejectionListeners: false,\n staleTimes: {\n dynamic: 0,\n static: 300,\ndiff --git a/packages/next/src/server/lib/start-server.ts b/packages/next/src/server/lib/start-server.ts\nindex f19cdd24a5309..35f1e5af30d3c 100644\n--- a/packages/next/src/server/lib/start-server.ts\n+++ b/packages/next/src/server/lib/start-server.ts\n@@ -30,7 +30,6 @@ import { CONFIG_FILES } from '../../shared/lib/constants'\n import { getStartServerInfo, logStartInfo } from './app-info-log'\n import { validateTurboNextConfig } from '../../lib/turbopack-warning'\n import { type Span, trace, flushAllTraces } from '../../trace'\n-import { isPostpone } from './router-utils/is-postpone'\n import { isIPv6 } from './is-ipv6'\n import { AsyncCallbackSet } from './async-callback-set'\n import type { NextServer } from '../next'\n@@ -331,29 +330,13 @@ export async function startServer(\n process.exit(0)\n })()\n }\n- const exception = (err: Error) => {\n- if (isPostpone(err)) {\n- // React postpones that are unhandled might end up logged here but they're\n- // not really errors. They're just part of rendering.\n- return\n- }\n \n- // This is the render worker, we keep the process alive\n- console.error(err)\n- }\n // Make sure commands gracefully respect termination signals (e.g. from Docker)\n // Allow the graceful termination to be manually configurable\n if (!process.env.NEXT_MANUAL_SIG_HANDLE) {\n process.on('SIGINT', cleanup)\n process.on('SIGTERM', cleanup)\n }\n- process.on('rejectionHandled', () => {\n- // It is ok to await a Promise late in Next.js as it allows for better\n- // prefetching patterns to avoid waterfalls. We ignore loggining these.\n- // We should've already errored in anyway unhandledRejection.\n- })\n- process.on('uncaughtException', exception)\n- process.on('unhandledRejection', exception)\n \n const initResult = await getRequestHandlers({\n dir,\ndiff --git a/packages/next/src/server/next-server.ts b/packages/next/src/server/next-server.ts\nindex eb98fd4bc565e..a66633b09efee 100644\n--- a/packages/next/src/server/next-server.ts\n+++ b/packages/next/src/server/next-server.ts\n@@ -112,6 +112,7 @@ import { AsyncCallbackSet } from './lib/async-callback-set'\n import { initializeCacheHandlers, setCacheHandler } from './use-cache/handlers'\n import type { UnwrapPromise } from '../lib/coalesced-function'\n import { populateStaticEnv } from '../lib/static-env'\n+import { isPostpone } from './lib/router-utils/is-postpone'\n \n export * from './base-server'\n \n@@ -159,6 +160,87 @@ function getMiddlewareMatcher(\n return matcher\n }\n \n+function installProcessErrorHandlers(\n+ shouldRemoveUnhandledRejectionListeners: boolean\n+) {\n+ // The conventional wisdom of Node.js and other runtimes is to treat\n+ // unhandled errors as fatal and exit the process.\n+ //\n+ // But Next.js is not a generic JS runtime — it's a specialized runtime for\n+ // React Server Components.\n+ //\n+ // Many unhandled rejections are due to the late-awaiting pattern for\n+ // prefetching data. In Next.js it's OK to call an async function without\n+ // immediately awaiting it, to start the request as soon as possible\n+ // without blocking unncessarily on the result. These can end up\n+ // triggering an \"unhandledRejection\" if it later turns out that the\n+ // data is not needed to render the page. Example:\n+ //\n+ // const promise = fetchData()\n+ // const shouldShow = await checkCondition()\n+ // if (shouldShow) {\n+ // return \n+ // }\n+ //\n+ // In this example, `fetchData` is called immediately to start the request\n+ // as soon as possible, but if `shouldShow` is false, then it will be\n+ // discarded without unwrapping its result. If it errors, it will trigger\n+ // an \"unhandledRejection\" event.\n+ //\n+ // Ideally, we would suppress these rejections completely without warning,\n+ // because we don't consider them real errors. (TODO: Currently we do warn.)\n+ //\n+ // But regardless of whether we do or don't warn, we definitely shouldn't\n+ // crash the entire process.\n+ //\n+ // Even a \"legit\" unhandled error unrelated to prefetching shouldn't\n+ // prevent the rest of the page from rendering.\n+ //\n+ // So, we're going to intentionally override the default error handling\n+ // behavior of the outer JS runtime to be more forgiving\n+\n+ // Remove any existing \"unhandledRejection\" handlers. This is gated behind\n+ // an experimental flag until we've considered the impact in various\n+ // deployment environments. It's possible this may always need to\n+ // be configurable.\n+ if (shouldRemoveUnhandledRejectionListeners) {\n+ process.removeAllListeners('unhandledRejection')\n+ }\n+\n+ // Install a new handler to prevent the process from crashing.\n+ process.on('unhandledRejection', (reason: unknown) => {\n+ if (isPostpone(reason)) {\n+ // React postpones that are unhandled might end up logged here but they're\n+ // not really errors. They're just part of rendering.\n+ return\n+ }\n+ // Immediately log the error.\n+ // TODO: Ideally, if we knew that this error was triggered by application\n+ // code, we would suppress it entirely without logging. We can't reliably\n+ // detect all of these, but when dynamicIO is enabled, we could suppress\n+ // at least some of them by waiting to log the error until after all in-\n+ // progress renders have completed. Then, only log errors for which there\n+ // was not a corresponding \"rejectionHandled\" event.\n+ console.error(reason)\n+ })\n+\n+ process.on('rejectionHandled', () => {\n+ // TODO: See note in the unhandledRejection handler above. In the future,\n+ // we may use the \"rejectionHandled\" event to de-queue an error from\n+ // being logged.\n+ })\n+\n+ // Unhandled exceptions are errors triggered by non-async functions, so this\n+ // is unrelated to the late-awaiting pattern. However, for similar reasons,\n+ // we still shouldn't crash the process. Just log it.\n+ process.on('uncaughtException', (reason: unknown) => {\n+ if (isPostpone(reason)) {\n+ return\n+ }\n+ console.error(reason)\n+ })\n+}\n+\n export default class NextNodeServer extends BaseServer<\n Options,\n NodeNextRequest,\n@@ -287,6 +369,11 @@ export default class NextNodeServer extends BaseServer<\n if (this.renderOpts.isExperimentalCompile) {\n populateStaticEnv(this.nextConfig)\n }\n+\n+ const shouldRemoveUnhandledRejectionListeners = Boolean(\n+ options.conf.experimental?.removeUnhandledRejectionListeners\n+ )\n+ installProcessErrorHandlers(shouldRemoveUnhandledRejectionListeners)\n }\n \n public async unstable_preloadEntries(): Promise {\n"},"modified_context":{"kind":"string","value":"diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts\nindex df29672da0216..463d270953f4f 100644\n--- a/packages/next/src/server/config-schema.ts\n+++ b/packages/next/src/server/config-schema.ts\n@@ -390,6 +390,7 @@ export const configSchema: zod.ZodType = z.lazy(() =>\n prerenderEarlyExit: z.boolean().optional(),\n proxyTimeout: z.number().gte(0).optional(),\n routerBFCache: z.boolean().optional(),\n+ removeUnhandledRejectionListeners: z.boolean().optional(),\n scrollRestoration: z.boolean().optional(),\n sri: z\n .object({\ndiff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts\nindex 2837e6e28dee1..b975d18039f3c 100644\n--- a/packages/next/src/server/config-shared.ts\n+++ b/packages/next/src/server/config-shared.ts\n@@ -509,6 +509,16 @@ export interface ExperimentalConfig {\n */\n routerBFCache?: boolean\n+ /**\n+ * Uninstalls all \"unhandledRejection\" listeners from the global process so\n+ * that we can override the behavior, which in some runtimes is to exit the\n+ * process on an unhandled rejection.\n+ *\n+ * This is experimental until we've considered the impact in various\n+ * deployment environments.\n+ */\n+ removeUnhandledRejectionListeners?: boolean\n serverActions?: {\n /**\n * Allows adjusting body parser size limit for server actions.\n@@ -1302,6 +1312,7 @@ export const defaultConfig: NextConfig = {\n useEarlyImport: false,\n viewTransition: false,\n routerBFCache: false,\n+ removeUnhandledRejectionListeners: false,\n staleTimes: {\n dynamic: 0,\n static: 300,\ndiff --git a/packages/next/src/server/lib/start-server.ts b/packages/next/src/server/lib/start-server.ts\nindex f19cdd24a5309..35f1e5af30d3c 100644\n--- a/packages/next/src/server/lib/start-server.ts\n+++ b/packages/next/src/server/lib/start-server.ts\n@@ -30,7 +30,6 @@ import { CONFIG_FILES } from '../../shared/lib/constants'\n import { getStartServerInfo, logStartInfo } from './app-info-log'\n import { validateTurboNextConfig } from '../../lib/turbopack-warning'\n import { type Span, trace, flushAllTraces } from '../../trace'\n-import { isPostpone } from './router-utils/is-postpone'\n import { isIPv6 } from './is-ipv6'\n import { AsyncCallbackSet } from './async-callback-set'\n import type { NextServer } from '../next'\n@@ -331,29 +330,13 @@ export async function startServer(\n process.exit(0)\n })()\n- const exception = (err: Error) => {\n- if (isPostpone(err)) {\n- // not really errors. They're just part of rendering.\n- return\n- // This is the render worker, we keep the process alive\n- console.error(err)\n- }\n // Make sure commands gracefully respect termination signals (e.g. from Docker)\n // Allow the graceful termination to be manually configurable\n if (!process.env.NEXT_MANUAL_SIG_HANDLE) {\n process.on('SIGINT', cleanup)\n process.on('SIGTERM', cleanup)\n- process.on('rejectionHandled', () => {\n- // It is ok to await a Promise late in Next.js as it allows for better\n- // prefetching patterns to avoid waterfalls. We ignore loggining these.\n- // We should've already errored in anyway unhandledRejection.\n- })\n- process.on('uncaughtException', exception)\n- process.on('unhandledRejection', exception)\n const initResult = await getRequestHandlers({\n dir,\ndiff --git a/packages/next/src/server/next-server.ts b/packages/next/src/server/next-server.ts\nindex eb98fd4bc565e..a66633b09efee 100644\n--- a/packages/next/src/server/next-server.ts\n+++ b/packages/next/src/server/next-server.ts\n@@ -112,6 +112,7 @@ import { AsyncCallbackSet } from './lib/async-callback-set'\n import { initializeCacheHandlers, setCacheHandler } from './use-cache/handlers'\n import type { UnwrapPromise } from '../lib/coalesced-function'\n import { populateStaticEnv } from '../lib/static-env'\n+import { isPostpone } from './lib/router-utils/is-postpone'\n export * from './base-server'\n@@ -159,6 +160,87 @@ function getMiddlewareMatcher(\n return matcher\n }\n+ shouldRemoveUnhandledRejectionListeners: boolean\n+) {\n+ // The conventional wisdom of Node.js and other runtimes is to treat\n+ // unhandled errors as fatal and exit the process.\n+ // But Next.js is not a generic JS runtime — it's a specialized runtime for\n+ // React Server Components.\n+ // Many unhandled rejections are due to the late-awaiting pattern for\n+ // prefetching data. In Next.js it's OK to call an async function without\n+ // immediately awaiting it, to start the request as soon as possible\n+ // without blocking unncessarily on the result. These can end up\n+ // triggering an \"unhandledRejection\" if it later turns out that the\n+ // data is not needed to render the page. Example:\n+ // const promise = fetchData()\n+ // const shouldShow = await checkCondition()\n+ // return \n+ // }\n+ // In this example, `fetchData` is called immediately to start the request\n+ // as soon as possible, but if `shouldShow` is false, then it will be\n+ // discarded without unwrapping its result. If it errors, it will trigger\n+ // Ideally, we would suppress these rejections completely without warning,\n+ // because we don't consider them real errors. (TODO: Currently we do warn.)\n+ // But regardless of whether we do or don't warn, we definitely shouldn't\n+ // crash the entire process.\n+ // Even a \"legit\" unhandled error unrelated to prefetching shouldn't\n+ // prevent the rest of the page from rendering.\n+ // So, we're going to intentionally override the default error handling\n+ // an experimental flag until we've considered the impact in various\n+ // deployment environments. It's possible this may always need to\n+ // be configurable.\n+ if (shouldRemoveUnhandledRejectionListeners) {\n+ process.removeAllListeners('unhandledRejection')\n+ }\n+ // Install a new handler to prevent the process from crashing.\n+ process.on('unhandledRejection', (reason: unknown) => {\n+ // not really errors. They're just part of rendering.\n+ // Immediately log the error.\n+ // TODO: Ideally, if we knew that this error was triggered by application\n+ // code, we would suppress it entirely without logging. We can't reliably\n+ // at least some of them by waiting to log the error until after all in-\n+ // progress renders have completed. Then, only log errors for which there\n+ // was not a corresponding \"rejectionHandled\" event.\n+ process.on('rejectionHandled', () => {\n+ // TODO: See note in the unhandledRejection handler above. In the future,\n+ // we may use the \"rejectionHandled\" event to de-queue an error from\n+ // being logged.\n+ // Unhandled exceptions are errors triggered by non-async functions, so this\n+ // is unrelated to the late-awaiting pattern. However, for similar reasons,\n+ // we still shouldn't crash the process. Just log it.\n+ process.on('uncaughtException', (reason: unknown) => {\n+}\n export default class NextNodeServer extends BaseServer<\n Options,\n NodeNextRequest,\n@@ -287,6 +369,11 @@ export default class NextNodeServer extends BaseServer<\n if (this.renderOpts.isExperimentalCompile) {\n populateStaticEnv(this.nextConfig)\n }\n+ const shouldRemoveUnhandledRejectionListeners = Boolean(\n+ options.conf.experimental?.removeUnhandledRejectionListeners\n+ )\n+ installProcessErrorHandlers(shouldRemoveUnhandledRejectionListeners)\n }\n public async unstable_preloadEntries(): Promise {"},"omitted_context":{"kind":"list like","value":["- // React postpones that are unhandled might end up logged here but they're","- }","+function installProcessErrorHandlers(","+ // if (shouldShow) {","+ // an \"unhandledRejection\" event.","+ // behavior of the outer JS runtime to be more forgiving","+ // Remove any existing \"unhandledRejection\" handlers. This is gated behind","+ // React postpones that are unhandled might end up logged here but they're","+ // detect all of these, but when dynamicIO is enabled, we could suppress"],"string":"[\n \"- // React postpones that are unhandled might end up logged here but they're\",\n \"- }\",\n \"+function installProcessErrorHandlers(\",\n \"+ // if (shouldShow) {\",\n \"+ // an \\\"unhandledRejection\\\" event.\",\n \"+ // behavior of the outer JS runtime to be more forgiving\",\n \"+ // Remove any existing \\\"unhandledRejection\\\" handlers. This is gated behind\",\n \"+ // React postpones that are unhandled might end up logged here but they're\",\n \"+ // detect all of these, but when dynamicIO is enabled, we could suppress\"\n]"},"omitted_index":{"kind":"list like","value":[59,62,99,117,124,136,138,149,156],"string":"[\n 59,\n 62,\n 99,\n 117,\n 124,\n 136,\n 138,\n 149,\n 156\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 99,\n \"author\": \"acdlite\",\n \"deletions\": 17,\n \"html_url\": \"https://github.com/vercel/next.js/pull/77997\",\n \"issue_id\": 77997,\n \"merged_at\": \"2025-04-10T20:31:28Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 77997,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Move unhandled rejection handling to shared path\",\n \"total_changes\": 116\n}"}}},{"rowIdx":320,"cells":{"id":{"kind":"number","value":320,"string":"320"},"original_context":{"kind":"string","value":"diff --git a/rust-toolchain.toml b/rust-toolchain.toml\nindex 41eb67abca569..e7fbc0c176d98 100644\n--- a/rust-toolchain.toml\n+++ b/rust-toolchain.toml\n@@ -1,4 +1,4 @@\n [toolchain]\n-channel = \"nightly-2025-02-12\"\n+channel = \"nightly-2025-04-10\"\n components = [\"rustfmt\", \"clippy\", \"rust-analyzer\"]\n profile = \"minimal\"\ndiff --git a/turbopack/crates/turbo-static/src/main.rs b/turbopack/crates/turbo-static/src/main.rs\nindex 8b996f62c08c5..498f80be8056a 100644\n--- a/turbopack/crates/turbo-static/src/main.rs\n+++ b/turbopack/crates/turbo-static/src/main.rs\n@@ -194,6 +194,7 @@ fn resolve_concurrency(\n \n for (ident, references) in dep_tree {\n for reference in references {\n+ #[allow(clippy::map_entry)] // This doesn't insert into dep_tree, so entry isn't useful\n if !dep_tree.contains_key(&reference.identifier) {\n // this is a task that is not in the task list\n // so we can't resolve it\ndiff --git a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\nindex 41998db9992d9..42526ed9e2b25 100644\n--- a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n@@ -1,5 +1,3 @@\n-#![feature(hash_extract_if)]\n-\n pub mod map;\n pub mod set;\n \ndiff --git a/turbopack/crates/turbo-tasks-fs/src/lib.rs b/turbopack/crates/turbo-tasks-fs/src/lib.rs\nindex 464f8d3867e95..20f8395e8b2f0 100644\n--- a/turbopack/crates/turbo-tasks-fs/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-fs/src/lib.rs\n@@ -1,6 +1,5 @@\n #![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this\n #![feature(trivial_bounds)]\n-#![feature(hash_extract_if)]\n #![feature(min_specialization)]\n #![feature(iter_advance_by)]\n #![feature(io_error_more)]\ndiff --git a/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr b/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr\nindex 7fb9a0baa3031..0a167e2e1632d 100644\n--- a/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr\n+++ b/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr\n@@ -4,6 +4,15 @@ error: methods taking `self` are not supported with `operation`\n 13 | fn arbitrary_self_type(self: OperationVc) -> Vc<()> {\n | ^^^^^^^^^^^^^^^^^^^^^^^\n \n+error[E0307]: invalid `self` parameter type: `OperationVc`\n+ --> tests/function/fail_operation_method_self_type.rs:13:34\n+ |\n+13 | fn arbitrary_self_type(self: OperationVc) -> Vc<()> {\n+ | ^^^^^^^^^^^^^^^^^\n+ |\n+ = note: type of `self` must be `Self` or some type implementing `Receiver`\n+ = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box`, `self: Rc`, or `self: Arc`\n+\n error[E0277]: the trait bound `fn(...) -> ... {...::arbitrary_self_type_turbo_tasks_function_inline}: IntoTaskFnWithThis<_, _, _>` is not satisfied\n --> tests/function/fail_operation_method_self_type.rs:10:1\n |\n@@ -22,12 +31,3 @@ note: required by a bound in `NativeFunction::new_method`\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `NativeFunction::new_method`\n = note: consider using `--verbose` to print the full type name to the console\n = note: this error originates in the attribute macro `turbo_tasks::value_impl` (in Nightly builds, run with -Z macro-backtrace for more info)\n-\n-error[E0307]: invalid `self` parameter type: `OperationVc`\n- --> tests/function/fail_operation_method_self_type.rs:13:34\n- |\n-13 | fn arbitrary_self_type(self: OperationVc) -> Vc<()> {\n- | ^^^^^^^^^^^^^^^^^\n- |\n- = note: type of `self` must be `Self` or some type implementing `Receiver`\n- = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box`, `self: Rc`, or `self: Arc`\ndiff --git a/turbopack/crates/turbo-tasks-memory/src/lib.rs b/turbopack/crates/turbo-tasks-memory/src/lib.rs\nindex 9f1f3e3ba67e4..bd2a5476b5b40 100644\n--- a/turbopack/crates/turbo-tasks-memory/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-memory/src/lib.rs\n@@ -1,4 +1,3 @@\n-#![feature(hash_extract_if)]\n #![feature(type_alias_impl_trait)]\n #![feature(box_patterns)]\n #![feature(int_roundings)]\ndiff --git a/turbopack/crates/turbo-tasks/src/lib.rs b/turbopack/crates/turbo-tasks/src/lib.rs\nindex 35a34f3e3f493..c76166d663222 100644\n--- a/turbopack/crates/turbo-tasks/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks/src/lib.rs\n@@ -29,7 +29,6 @@\n #![feature(trivial_bounds)]\n #![feature(min_specialization)]\n #![feature(try_trait_v2)]\n-#![feature(hash_extract_if)]\n #![deny(unsafe_op_in_unsafe_fn)]\n #![feature(result_flattening)]\n #![feature(error_generic_member_access)]\ndiff --git a/turbopack/crates/turbopack-css/src/process.rs b/turbopack/crates/turbopack-css/src/process.rs\nindex 81120ec02f420..1ca595ce6779b 100644\n--- a/turbopack/crates/turbopack-css/src/process.rs\n+++ b/turbopack/crates/turbopack-css/src/process.rs\n@@ -112,6 +112,7 @@ impl StyleSheetLike<'_, '_> {\n pub struct UnresolvedUrlReferences(pub Vec<(String, ResolvedVc)>);\n \n #[turbo_tasks::value(shared, serialization = \"none\", eq = \"manual\", cell = \"new\")]\n+#[allow(clippy::large_enum_variant)] // This is a turbo-tasks value\n pub enum ParseCssResult {\n Ok {\n code: ResolvedVc,\ndiff --git a/turbopack/crates/turbopack-dev-server/src/http.rs b/turbopack/crates/turbopack-dev-server/src/http.rs\nindex 62b2acac33f1e..84d6657396f2b 100644\n--- a/turbopack/crates/turbopack-dev-server/src/http.rs\n+++ b/turbopack/crates/turbopack-dev-server/src/http.rs\n@@ -1,5 +1,3 @@\n-use std::io::{Error, ErrorKind};\n-\n use anyhow::{anyhow, Result};\n use auto_hash_map::AutoSet;\n use futures::{StreamExt, TryStreamExt};\n@@ -177,10 +175,7 @@ pub async fn process_request_with_content_source(\n header_map.insert(CONTENT_ENCODING, HeaderValue::from_static(\"gzip\"));\n \n // Grab ropereader stream, coerce anyhow::Error to std::io::Error\n- let stream_ext = content\n- .read()\n- .into_stream()\n- .map_err(|err| Error::new(ErrorKind::Other, err));\n+ let stream_ext = content.read().into_stream().map_err(std::io::Error::other);\n \n let gzipped_stream =\n ReaderStream::new(async_compression::tokio::bufread::GzipEncoder::new(\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs b/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs\nindex ad799d688e226..f9e314008fbba 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs\n@@ -1516,10 +1516,9 @@ impl VisitAstPath for Analyzer<'_> {\n decl: &'ast FnDecl,\n ast_path: &mut AstNodePath>,\n ) {\n- let old = replace(\n- &mut self.cur_fn_return_values,\n- Some(get_fn_init_return_vals(decl.function.body.as_ref())),\n- );\n+ let old = self\n+ .cur_fn_return_values\n+ .replace(get_fn_init_return_vals(decl.function.body.as_ref()));\n let old_ident = self.cur_fn_ident;\n self.cur_fn_ident = decl.function.span.lo.0;\n decl.visit_children_with_ast_path(self, ast_path);\n@@ -1540,10 +1539,9 @@ impl VisitAstPath for Analyzer<'_> {\n expr: &'ast FnExpr,\n ast_path: &mut AstNodePath>,\n ) {\n- let old = replace(\n- &mut self.cur_fn_return_values,\n- Some(get_fn_init_return_vals(expr.function.body.as_ref())),\n- );\n+ let old = self\n+ .cur_fn_return_values\n+ .replace(get_fn_init_return_vals(expr.function.body.as_ref()));\n let old_ident = self.cur_fn_ident;\n self.cur_fn_ident = expr.function.span.lo.0;\n expr.visit_children_with_ast_path(self, ast_path);\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs b/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs\nindex 4c9000aa06aed..e42c497047d90 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs\n@@ -191,8 +191,8 @@ impl Comments for ImmutableComments {\n }\n \n pub struct CowComments<'a> {\n- leading: RefCell>>>,\n- trailing: RefCell>>>,\n+ leading: RefCell>>,\n+ trailing: RefCell>>,\n }\n \n impl<'a> CowComments<'a> {\n@@ -202,14 +202,14 @@ impl<'a> CowComments<'a> {\n comments\n .leading\n .iter()\n- .map(|(&key, value)| (key, Cow::Borrowed(value)))\n+ .map(|(&key, value)| (key, Cow::Borrowed(&value[..])))\n .collect(),\n ),\n trailing: RefCell::new(\n comments\n .trailing\n .iter()\n- .map(|(&key, value)| (key, Cow::Borrowed(value)))\n+ .map(|(&key, value)| (key, Cow::Borrowed(&value[..])))\n .collect(),\n ),\n }\n@@ -274,7 +274,7 @@ impl Comments for CowComments<'_> {\n &self,\n pos: swc_core::common::BytePos,\n ) -> Option> {\n- self.leading.borrow().get(&pos).map(|v| (**v).clone())\n+ self.leading.borrow().get(&pos).map(|v| (**v).to_vec())\n }\n \n fn add_trailing(\n@@ -315,7 +315,7 @@ impl Comments for CowComments<'_> {\n &self,\n pos: swc_core::common::BytePos,\n ) -> Option> {\n- self.trailing.borrow().get(&pos).map(|v| (**v).clone())\n+ self.trailing.borrow().get(&pos).map(|v| (**v).to_vec())\n }\n \n fn add_pure_comment(&self, _pos: swc_core::common::BytePos) {\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/utils.rs b/turbopack/crates/turbopack-ecmascript/src/utils.rs\nindex a8ccc105be5ab..2e83eb5a654dd 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/utils.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/utils.rs\n@@ -114,11 +114,8 @@ where\n impl std::io::Write for DisplayWriter<'_, '_> {\n fn write(&mut self, bytes: &[u8]) -> std::result::Result {\n self.f\n- .write_str(\n- std::str::from_utf8(bytes)\n- .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?,\n- )\n- .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;\n+ .write_str(std::str::from_utf8(bytes).map_err(std::io::Error::other)?)\n+ .map_err(std::io::Error::other)?;\n Ok(bytes.len())\n }\n \ndiff --git a/turbopack/crates/turbopack-node/src/lib.rs b/turbopack/crates/turbopack-node/src/lib.rs\nindex 672736fca9388..606c9022e2b4e 100644\n--- a/turbopack/crates/turbopack-node/src/lib.rs\n+++ b/turbopack/crates/turbopack-node/src/lib.rs\n@@ -1,7 +1,6 @@\n #![feature(min_specialization)]\n #![feature(arbitrary_self_types)]\n #![feature(arbitrary_self_types_pointers)]\n-#![feature(extract_if)]\n \n use std::{iter::once, thread::available_parallelism};\n \ndiff --git a/turbopack/crates/turbopack-trace-server/src/store.rs b/turbopack/crates/turbopack-trace-server/src/store.rs\nindex e520e187aaa0c..b37892907b3c2 100644\n--- a/turbopack/crates/turbopack-trace-server/src/store.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/store.rs\n@@ -1,7 +1,6 @@\n use std::{\n cmp::{max, min},\n env,\n- mem::replace,\n num::NonZeroUsize,\n sync::{atomic::AtomicU64, OnceLock},\n };\n@@ -266,7 +265,7 @@ impl Store {\n outdated_spans.insert(span_index);\n let span = &mut self.spans[span_index.get()];\n \n- let old_parent = replace(&mut span.parent, Some(parent));\n+ let old_parent = span.parent.replace(parent);\n let old_parent = if let Some(parent) = old_parent {\n outdated_spans.insert(parent);\n &mut self.spans[parent.get()]\n"},"modified_context":{"kind":"string","value":"diff --git a/rust-toolchain.toml b/rust-toolchain.toml\nindex 41eb67abca569..e7fbc0c176d98 100644\n--- a/rust-toolchain.toml\n+++ b/rust-toolchain.toml\n@@ -1,4 +1,4 @@\n [toolchain]\n-channel = \"nightly-2025-02-12\"\n+channel = \"nightly-2025-04-10\"\n components = [\"rustfmt\", \"clippy\", \"rust-analyzer\"]\n profile = \"minimal\"\ndiff --git a/turbopack/crates/turbo-static/src/main.rs b/turbopack/crates/turbo-static/src/main.rs\nindex 8b996f62c08c5..498f80be8056a 100644\n--- a/turbopack/crates/turbo-static/src/main.rs\n+++ b/turbopack/crates/turbo-static/src/main.rs\n@@ -194,6 +194,7 @@ fn resolve_concurrency(\n for (ident, references) in dep_tree {\n for reference in references {\n+ #[allow(clippy::map_entry)] // This doesn't insert into dep_tree, so entry isn't useful\n if !dep_tree.contains_key(&reference.identifier) {\n // this is a task that is not in the task list\n // so we can't resolve it\ndiff --git a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\nindex 41998db9992d9..42526ed9e2b25 100644\n--- a/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-auto-hash-map/src/lib.rs\n pub mod map;\n pub mod set;\ndiff --git a/turbopack/crates/turbo-tasks-fs/src/lib.rs b/turbopack/crates/turbo-tasks-fs/src/lib.rs\nindex 464f8d3867e95..20f8395e8b2f0 100644\n--- a/turbopack/crates/turbo-tasks-fs/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-fs/src/lib.rs\n@@ -1,6 +1,5 @@\n #![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this\n #![feature(iter_advance_by)]\n #![feature(io_error_more)]\ndiff --git a/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr b/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr\nindex 7fb9a0baa3031..0a167e2e1632d 100644\n--- a/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr\n+++ b/turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_method_self_type.stderr\n@@ -4,6 +4,15 @@ error: methods taking `self` are not supported with `operation`\n 13 | fn arbitrary_self_type(self: OperationVc) -> Vc<()> {\n | ^^^^^^^^^^^^^^^^^^^^^^^\n+error[E0307]: invalid `self` parameter type: `OperationVc`\n+ --> tests/function/fail_operation_method_self_type.rs:13:34\n+13 | fn arbitrary_self_type(self: OperationVc) -> Vc<()> {\n+ | ^^^^^^^^^^^^^^^^^\n+ = note: type of `self` must be `Self` or some type implementing `Receiver`\n+ = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box`, `self: Rc`, or `self: Arc`\n+\n error[E0277]: the trait bound `fn(...) -> ... {...::arbitrary_self_type_turbo_tasks_function_inline}: IntoTaskFnWithThis<_, _, _>` is not satisfied\n --> tests/function/fail_operation_method_self_type.rs:10:1\n |\n@@ -22,12 +31,3 @@ note: required by a bound in `NativeFunction::new_method`\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `NativeFunction::new_method`\n = note: consider using `--verbose` to print the full type name to the console\n = note: this error originates in the attribute macro `turbo_tasks::value_impl` (in Nightly builds, run with -Z macro-backtrace for more info)\n-error[E0307]: invalid `self` parameter type: `OperationVc`\n- --> tests/function/fail_operation_method_self_type.rs:13:34\n-13 | fn arbitrary_self_type(self: OperationVc) -> Vc<()> {\n- | ^^^^^^^^^^^^^^^^^\n- = note: type of `self` must be `Self` or some type implementing `Receiver`\n- = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box`, `self: Rc`, or `self: Arc`\ndiff --git a/turbopack/crates/turbo-tasks-memory/src/lib.rs b/turbopack/crates/turbo-tasks-memory/src/lib.rs\nindex 9f1f3e3ba67e4..bd2a5476b5b40 100644\n--- a/turbopack/crates/turbo-tasks-memory/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks-memory/src/lib.rs\n@@ -1,4 +1,3 @@\n #![feature(type_alias_impl_trait)]\n #![feature(box_patterns)]\n #![feature(int_roundings)]\ndiff --git a/turbopack/crates/turbo-tasks/src/lib.rs b/turbopack/crates/turbo-tasks/src/lib.rs\nindex 35a34f3e3f493..c76166d663222 100644\n--- a/turbopack/crates/turbo-tasks/src/lib.rs\n+++ b/turbopack/crates/turbo-tasks/src/lib.rs\n@@ -29,7 +29,6 @@\n #![feature(try_trait_v2)]\n #![deny(unsafe_op_in_unsafe_fn)]\n #![feature(result_flattening)]\n #![feature(error_generic_member_access)]\ndiff --git a/turbopack/crates/turbopack-css/src/process.rs b/turbopack/crates/turbopack-css/src/process.rs\nindex 81120ec02f420..1ca595ce6779b 100644\n--- a/turbopack/crates/turbopack-css/src/process.rs\n+++ b/turbopack/crates/turbopack-css/src/process.rs\n@@ -112,6 +112,7 @@ impl StyleSheetLike<'_, '_> {\n pub struct UnresolvedUrlReferences(pub Vec<(String, ResolvedVc)>);\n #[turbo_tasks::value(shared, serialization = \"none\", eq = \"manual\", cell = \"new\")]\n pub enum ParseCssResult {\n Ok {\n code: ResolvedVc,\ndiff --git a/turbopack/crates/turbopack-dev-server/src/http.rs b/turbopack/crates/turbopack-dev-server/src/http.rs\nindex 62b2acac33f1e..84d6657396f2b 100644\n--- a/turbopack/crates/turbopack-dev-server/src/http.rs\n+++ b/turbopack/crates/turbopack-dev-server/src/http.rs\n-use std::io::{Error, ErrorKind};\n use anyhow::{anyhow, Result};\n use auto_hash_map::AutoSet;\n use futures::{StreamExt, TryStreamExt};\n@@ -177,10 +175,7 @@ pub async fn process_request_with_content_source(\n header_map.insert(CONTENT_ENCODING, HeaderValue::from_static(\"gzip\"));\n // Grab ropereader stream, coerce anyhow::Error to std::io::Error\n- let stream_ext = content\n- .read()\n- .into_stream()\n- .map_err(|err| Error::new(ErrorKind::Other, err));\n+ let stream_ext = content.read().into_stream().map_err(std::io::Error::other);\n let gzipped_stream =\n ReaderStream::new(async_compression::tokio::bufread::GzipEncoder::new(\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs b/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs\nindex ad799d688e226..f9e314008fbba 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs\n@@ -1516,10 +1516,9 @@ impl VisitAstPath for Analyzer<'_> {\n decl: &'ast FnDecl,\n- Some(get_fn_init_return_vals(decl.function.body.as_ref())),\n+ .replace(get_fn_init_return_vals(decl.function.body.as_ref()));\n self.cur_fn_ident = decl.function.span.lo.0;\n decl.visit_children_with_ast_path(self, ast_path);\n@@ -1540,10 +1539,9 @@ impl VisitAstPath for Analyzer<'_> {\n expr: &'ast FnExpr,\n- Some(get_fn_init_return_vals(expr.function.body.as_ref())),\n+ .replace(get_fn_init_return_vals(expr.function.body.as_ref()));\n self.cur_fn_ident = expr.function.span.lo.0;\n expr.visit_children_with_ast_path(self, ast_path);\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs b/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs\nindex 4c9000aa06aed..e42c497047d90 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/swc_comments.rs\n@@ -191,8 +191,8 @@ impl Comments for ImmutableComments {\n pub struct CowComments<'a> {\n- leading: RefCell>>>,\n- trailing: RefCell>>>,\n+ leading: RefCell>>,\n+ trailing: RefCell>>,\n impl<'a> CowComments<'a> {\n@@ -202,14 +202,14 @@ impl<'a> CowComments<'a> {\n .leading\n trailing: RefCell::new(\n .trailing\n }\n@@ -274,7 +274,7 @@ impl Comments for CowComments<'_> {\n- self.leading.borrow().get(&pos).map(|v| (**v).clone())\n+ self.leading.borrow().get(&pos).map(|v| (**v).to_vec())\n fn add_trailing(\n@@ -315,7 +315,7 @@ impl Comments for CowComments<'_> {\n- self.trailing.borrow().get(&pos).map(|v| (**v).clone())\n+ self.trailing.borrow().get(&pos).map(|v| (**v).to_vec())\n fn add_pure_comment(&self, _pos: swc_core::common::BytePos) {\ndiff --git a/turbopack/crates/turbopack-ecmascript/src/utils.rs b/turbopack/crates/turbopack-ecmascript/src/utils.rs\nindex a8ccc105be5ab..2e83eb5a654dd 100644\n--- a/turbopack/crates/turbopack-ecmascript/src/utils.rs\n+++ b/turbopack/crates/turbopack-ecmascript/src/utils.rs\n@@ -114,11 +114,8 @@ where\n impl std::io::Write for DisplayWriter<'_, '_> {\n fn write(&mut self, bytes: &[u8]) -> std::result::Result {\n self.f\n- .write_str(\n- std::str::from_utf8(bytes)\n- .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?,\n- )\n- .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;\n+ .write_str(std::str::from_utf8(bytes).map_err(std::io::Error::other)?)\n+ .map_err(std::io::Error::other)?;\n Ok(bytes.len())\n }\ndiff --git a/turbopack/crates/turbopack-node/src/lib.rs b/turbopack/crates/turbopack-node/src/lib.rs\nindex 672736fca9388..606c9022e2b4e 100644\n--- a/turbopack/crates/turbopack-node/src/lib.rs\n+++ b/turbopack/crates/turbopack-node/src/lib.rs\n #![feature(arbitrary_self_types)]\n #![feature(arbitrary_self_types_pointers)]\n-#![feature(extract_if)]\n use std::{iter::once, thread::available_parallelism};\ndiff --git a/turbopack/crates/turbopack-trace-server/src/store.rs b/turbopack/crates/turbopack-trace-server/src/store.rs\nindex e520e187aaa0c..b37892907b3c2 100644\n--- a/turbopack/crates/turbopack-trace-server/src/store.rs\n+++ b/turbopack/crates/turbopack-trace-server/src/store.rs\n use std::{\n cmp::{max, min},\n env,\n- mem::replace,\n num::NonZeroUsize,\n sync::{atomic::AtomicU64, OnceLock},\n };\n@@ -266,7 +265,7 @@ impl Store {\n outdated_spans.insert(span_index);\n let span = &mut self.spans[span_index.get()];\n- let old_parent = replace(&mut span.parent, Some(parent));\n+ let old_parent = span.parent.replace(parent);\n let old_parent = if let Some(parent) = old_parent {\n outdated_spans.insert(parent);\n &mut self.spans[parent.get()]"},"omitted_context":{"kind":"list like","value":["+#[allow(clippy::large_enum_variant)] // This is a turbo-tasks value"],"string":"[\n \"+#[allow(clippy::large_enum_variant)] // This is a turbo-tasks value\"\n]"},"omitted_index":{"kind":"list like","value":[105],"string":"[\n 105\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 28,\n \"author\": \"wbinnssmith\",\n \"deletions\": 43,\n \"html_url\": \"https://github.com/vercel/next.js/pull/78039\",\n \"issue_id\": 78039,\n \"merged_at\": \"2025-04-10T21:51:23Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 78039,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Update Rust toolchain to nightly-2025-04-10\",\n \"total_changes\": 71\n}"}}},{"rowIdx":321,"cells":{"id":{"kind":"number","value":321,"string":"321"},"original_context":{"kind":"string","value":"diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts\nindex 9d85556ab49c0..f7cbf822fff76 100644\n--- a/packages/next/src/build/index.ts\n+++ b/packages/next/src/build/index.ts\n@@ -3301,6 +3301,16 @@ export default async function build(\n orig,\n path.join(distDir, 'server', updatedRelativeDest)\n )\n+\n+ // since the app router not found is prioritized over pages router,\n+ // we have to ensure the app router entries are available for all locales\n+ if (i18n) {\n+ for (const locale of i18n.locales) {\n+ const curPath = `/${locale}/404`\n+ pagesManifest[curPath] = updatedRelativeDest\n+ }\n+ }\n+\n pagesManifest['/404'] = updatedRelativeDest\n }\n })\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/app/app-dir/[[...slug]]/page.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/app/app-dir/[[...slug]]/page.tsx\nnew file mode 100644\nindex 0000000000000..84e51b866c775\n--- /dev/null\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/app/app-dir/[[...slug]]/page.tsx\n@@ -0,0 +1,44 @@\n+import { notFound } from 'next/navigation'\n+\n+export async function generateStaticParams() {\n+ return []\n+}\n+\n+async function validateSlug(slug: string[]) {\n+ try {\n+ const isValidPath =\n+ slug.length === 1 && (slug[0] === 'about' || slug[0] === 'contact')\n+\n+ if (!isValidPath) {\n+ return false\n+ }\n+\n+ return true\n+ } catch (error) {\n+ throw error\n+ }\n+}\n+\n+export default async function CatchAll({\n+ params,\n+}: {\n+ params: Promise<{ slug: string[] }>\n+}) {\n+ const { slug } = await params\n+ const slugArray = Array.isArray(slug) ? slug : [slug]\n+\n+ // Validate the slug\n+ const isValid = await validateSlug(slugArray)\n+\n+ // If not valid, show 404\n+ if (!isValid) {\n+ notFound()\n+ }\n+\n+ return (\n+
\n+

Catch All

\n+

This is a catch all page added to the APP router

\n+
\n+ )\n+}\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/app/layout.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/app/layout.tsx\nnew file mode 100644\nindex 0000000000000..a14e64fcd5e33\n--- /dev/null\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/app/layout.tsx\n@@ -0,0 +1,16 @@\n+export const metadata = {\n+ title: 'Next.js',\n+ description: 'Generated by Next.js',\n+}\n+\n+export default function RootLayout({\n+ children,\n+}: {\n+ children: React.ReactNode\n+}) {\n+ return (\n+ \n+ {children}\n+ \n+ )\n+}\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/app/not-found.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/app/not-found.tsx\nnew file mode 100644\nindex 0000000000000..9e2f20f4cca7c\n--- /dev/null\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/app/not-found.tsx\n@@ -0,0 +1,10 @@\n+import React from 'react'\n+\n+const NotFound = () => (\n+
\n+

APP ROUTER - 404 PAGE

\n+

This page is using the APP ROUTER

\n+
\n+)\n+\n+export default NotFound\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/next.config.js b/test/e2e/app-dir/not-found-with-pages-i18n/next.config.js\nnew file mode 100644\nindex 0000000000000..ee7663cef2d2b\n--- /dev/null\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/next.config.js\n@@ -0,0 +1,12 @@\n+/**\n+ * @type {import('next').NextConfig}\n+ */\n+const nextConfig = {\n+ i18n: {\n+ locales: ['en-GB', 'en'],\n+ defaultLocale: 'en',\n+ localeDetection: false,\n+ },\n+}\n+\n+module.exports = nextConfig\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/not-found-with-pages.test.ts b/test/e2e/app-dir/not-found-with-pages-i18n/not-found-with-pages.test.ts\nnew file mode 100644\nindex 0000000000000..5b6a635bd3d6b\n--- /dev/null\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/not-found-with-pages.test.ts\n@@ -0,0 +1,31 @@\n+import { nextTestSetup } from 'e2e-utils'\n+\n+describe('not-found-with-pages', () => {\n+ const { next, isNextStart } = nextTestSetup({\n+ files: __dirname,\n+ })\n+\n+ if (isNextStart) {\n+ it('should write all locales to the pages manifest', async () => {\n+ const pagesManifest = JSON.parse(\n+ await next.readFile('.next/server/pages-manifest.json')\n+ )\n+\n+ expect(pagesManifest['/404']).toBe('pages/404.html')\n+ expect(pagesManifest['/en/404']).toBe('pages/404.html')\n+ expect(pagesManifest['/en-GB/404']).toBe('pages/404.html')\n+ })\n+ }\n+\n+ it('should prefer the app router 404 over the pages router 404 when both are present', async () => {\n+ const browser = await next.browser('/app-dir/foo')\n+ expect(await browser.elementByCss('h1').text()).toBe(\n+ 'APP ROUTER - 404 PAGE'\n+ )\n+\n+ await browser.loadPage(next.url)\n+ expect(await browser.elementByCss('h1').text()).toBe(\n+ 'APP ROUTER - 404 PAGE'\n+ )\n+ })\n+})\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/pages/404.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/pages/404.tsx\nnew file mode 100644\nindex 0000000000000..be5a6a9368ef2\n--- /dev/null\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/pages/404.tsx\n@@ -0,0 +1,24 @@\n+import React from 'react'\n+import { GetStaticProps } from 'next'\n+\n+interface NotFoundProps {\n+ message: string\n+}\n+\n+const NotFound = ({ message }: NotFoundProps) => (\n+
\n+

PAGES ROUTER - 404 PAGE

\n+

This page is using the PAGES ROUTER

\n+

{message}

\n+
\n+)\n+\n+export const getStaticProps: GetStaticProps = async () => {\n+ return {\n+ props: {\n+ message: 'Custom message fetched at build time',\n+ },\n+ }\n+}\n+\n+export default NotFound\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/pages/[[...slug]].tsx b/test/e2e/app-dir/not-found-with-pages-i18n/pages/[[...slug]].tsx\nnew file mode 100644\nindex 0000000000000..2da5fd5f318d5\n--- /dev/null\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/pages/[[...slug]].tsx\n@@ -0,0 +1,39 @@\n+import React from 'react'\n+\n+export const getStaticProps = ({ params }: { params: { slug: string[] } }) => {\n+ try {\n+ const slugArray = Array.isArray(params.slug) ? params.slug : [params.slug]\n+\n+ const isValidPath =\n+ slugArray.length === 1 &&\n+ (slugArray[0] === 'about' || slugArray[0] === 'contact')\n+\n+ if (!isValidPath) {\n+ return {\n+ notFound: true,\n+ }\n+ }\n+\n+ return {\n+ props: {\n+ slug: params.slug,\n+ },\n+ }\n+ } catch (error) {\n+ throw error\n+ }\n+}\n+\n+export const getStaticPaths = async () => ({\n+ paths: [],\n+ fallback: 'blocking',\n+})\n+\n+const CatchAll = () => (\n+
\n+

Catch All

\n+

This is a catch all page added to the pages router

\n+
\n+)\n+\n+export default CatchAll\n"},"modified_context":{"kind":"string","value":"diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts\nindex 9d85556ab49c0..f7cbf822fff76 100644\n--- a/packages/next/src/build/index.ts\n+++ b/packages/next/src/build/index.ts\n@@ -3301,6 +3301,16 @@ export default async function build(\n orig,\n path.join(distDir, 'server', updatedRelativeDest)\n )\n+ // since the app router not found is prioritized over pages router,\n+ // we have to ensure the app router entries are available for all locales\n+ if (i18n) {\n+ const curPath = `/${locale}/404`\n+ pagesManifest[curPath] = updatedRelativeDest\n+ }\n+ }\n pagesManifest['/404'] = updatedRelativeDest\n }\n })\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/app/app-dir/[[...slug]]/page.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/app/app-dir/[[...slug]]/page.tsx\nindex 0000000000000..84e51b866c775\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/app/app-dir/[[...slug]]/page.tsx\n@@ -0,0 +1,44 @@\n+import { notFound } from 'next/navigation'\n+export async function generateStaticParams() {\n+ return []\n+async function validateSlug(slug: string[]) {\n+ slug.length === 1 && (slug[0] === 'about' || slug[0] === 'contact')\n+ return false\n+ return true\n+export default async function CatchAll({\n+ params: Promise<{ slug: string[] }>\n+ const { slug } = await params\n+ const slugArray = Array.isArray(slug) ? slug : [slug]\n+ // Validate the slug\n+ const isValid = await validateSlug(slugArray)\n+ if (!isValid) {\n+ notFound()\n+
\n+

Catch All

\n+

This is a catch all page added to the APP router

\n+
\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/app/layout.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/app/layout.tsx\nindex 0000000000000..a14e64fcd5e33\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/app/layout.tsx\n@@ -0,0 +1,16 @@\n+export const metadata = {\n+ title: 'Next.js',\n+ description: 'Generated by Next.js',\n+export default function RootLayout({\n+ children,\n+ children: React.ReactNode\n+ \n+ {children}\n+ \ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/app/not-found.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/app/not-found.tsx\nindex 0000000000000..9e2f20f4cca7c\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/app/not-found.tsx\n@@ -0,0 +1,10 @@\n+const NotFound = () => (\n+

APP ROUTER - 404 PAGE

\n+

This page is using the APP ROUTER

\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/next.config.js b/test/e2e/app-dir/not-found-with-pages-i18n/next.config.js\nindex 0000000000000..ee7663cef2d2b\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/next.config.js\n@@ -0,0 +1,12 @@\n+/**\n+ * @type {import('next').NextConfig}\n+ */\n+const nextConfig = {\n+ i18n: {\n+ locales: ['en-GB', 'en'],\n+ defaultLocale: 'en',\n+ localeDetection: false,\n+ },\n+module.exports = nextConfig\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/not-found-with-pages.test.ts b/test/e2e/app-dir/not-found-with-pages-i18n/not-found-with-pages.test.ts\nindex 0000000000000..5b6a635bd3d6b\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/not-found-with-pages.test.ts\n@@ -0,0 +1,31 @@\n+import { nextTestSetup } from 'e2e-utils'\n+describe('not-found-with-pages', () => {\n+ const { next, isNextStart } = nextTestSetup({\n+ files: __dirname,\n+ if (isNextStart) {\n+ it('should write all locales to the pages manifest', async () => {\n+ await next.readFile('.next/server/pages-manifest.json')\n+ )\n+ expect(pagesManifest['/404']).toBe('pages/404.html')\n+ expect(pagesManifest['/en-GB/404']).toBe('pages/404.html')\n+ })\n+ it('should prefer the app router 404 over the pages router 404 when both are present', async () => {\n+ const browser = await next.browser('/app-dir/foo')\n+ await browser.loadPage(next.url)\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/pages/404.tsx b/test/e2e/app-dir/not-found-with-pages-i18n/pages/404.tsx\nindex 0000000000000..be5a6a9368ef2\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/pages/404.tsx\n@@ -0,0 +1,24 @@\n+import { GetStaticProps } from 'next'\n+interface NotFoundProps {\n+ message: string\n+const NotFound = ({ message }: NotFoundProps) => (\n+

PAGES ROUTER - 404 PAGE

\n+

This page is using the PAGES ROUTER

\n+ return {\n+ props: {\n+ message: 'Custom message fetched at build time',\n+ },\ndiff --git a/test/e2e/app-dir/not-found-with-pages-i18n/pages/[[...slug]].tsx b/test/e2e/app-dir/not-found-with-pages-i18n/pages/[[...slug]].tsx\nindex 0000000000000..2da5fd5f318d5\n+++ b/test/e2e/app-dir/not-found-with-pages-i18n/pages/[[...slug]].tsx\n@@ -0,0 +1,39 @@\n+export const getStaticProps = ({ params }: { params: { slug: string[] } }) => {\n+ slugArray.length === 1 &&\n+ (slugArray[0] === 'about' || slugArray[0] === 'contact')\n+ return {\n+ notFound: true,\n+ }\n+ return {\n+ props: {\n+ slug: params.slug,\n+ },\n+export const getStaticPaths = async () => ({\n+ paths: [],\n+ fallback: 'blocking',\n+const CatchAll = () => (\n+

Catch All

\n+

This is a catch all page added to the pages router

\n+export default CatchAll"},"omitted_context":{"kind":"list like","value":["+ for (const locale of i18n.locales) {","+ params,","+ // If not valid, show 404","+ const pagesManifest = JSON.parse(","+ expect(pagesManifest['/en/404']).toBe('pages/404.html')","+

{message}

","+export const getStaticProps: GetStaticProps = async () => {","+ const slugArray = Array.isArray(params.slug) ? params.slug : [params.slug]"],"string":"[\n \"+ for (const locale of i18n.locales) {\",\n \"+ params,\",\n \"+ // If not valid, show 404\",\n \"+ const pagesManifest = JSON.parse(\",\n \"+ expect(pagesManifest['/en/404']).toBe('pages/404.html')\",\n \"+

{message}

\",\n \"+export const getStaticProps: GetStaticProps = async () => {\",\n \"+ const slugArray = Array.isArray(params.slug) ? params.slug : [params.slug]\"\n]"},"omitted_index":{"kind":"list like","value":[12,49,59,142,147,181,185,204],"string":"[\n 12,\n 49,\n 59,\n 142,\n 147,\n 181,\n 185,\n 204\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 186,\n \"author\": \"ztanner\",\n \"deletions\": 0,\n \"html_url\": \"https://github.com/vercel/next.js/pull/77905\",\n \"issue_id\": 77905,\n \"merged_at\": \"2025-04-10T22:44:59Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 77905,\n \"repo\": \"vercel/next.js\",\n \"title\": \"fix: ensure app router not found works when deployed with pages i18n config\",\n \"total_changes\": 186\n}"}}},{"rowIdx":322,"cells":{"id":{"kind":"number","value":322,"string":"322"},"original_context":{"kind":"string","value":"diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts\nindex 463d270953f4f..6db12ca87290e 100644\n--- a/packages/next/src/server/config-schema.ts\n+++ b/packages/next/src/server/config-schema.ts\n@@ -390,7 +390,7 @@ export const configSchema: zod.ZodType = z.lazy(() =>\n prerenderEarlyExit: z.boolean().optional(),\n proxyTimeout: z.number().gte(0).optional(),\n routerBFCache: z.boolean().optional(),\n- removeUnhandledRejectionListeners: z.boolean().optional(),\n+ removeUncaughtErrorAndRejectionListeners: z.boolean().optional(),\n scrollRestoration: z.boolean().optional(),\n sri: z\n .object({\ndiff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts\nindex b975d18039f3c..fc8c63442106b 100644\n--- a/packages/next/src/server/config-shared.ts\n+++ b/packages/next/src/server/config-shared.ts\n@@ -510,14 +510,14 @@ export interface ExperimentalConfig {\n routerBFCache?: boolean\n \n /**\n- * Uninstalls all \"unhandledRejection\" listeners from the global process so\n- * that we can override the behavior, which in some runtimes is to exit the\n- * process on an unhandled rejection.\n+ * Uninstalls all \"unhandledRejection\" and \"uncaughtException\" listeners from\n+ * the global process so that we can override the behavior, which in some\n+ * runtimes is to exit the process.\n *\n * This is experimental until we've considered the impact in various\n * deployment environments.\n */\n- removeUnhandledRejectionListeners?: boolean\n+ removeUncaughtErrorAndRejectionListeners?: boolean\n \n serverActions?: {\n /**\n@@ -1312,7 +1312,7 @@ export const defaultConfig: NextConfig = {\n useEarlyImport: false,\n viewTransition: false,\n routerBFCache: false,\n- removeUnhandledRejectionListeners: false,\n+ removeUncaughtErrorAndRejectionListeners: false,\n staleTimes: {\n dynamic: 0,\n static: 300,\ndiff --git a/packages/next/src/server/next-server.ts b/packages/next/src/server/next-server.ts\nindex a66633b09efee..a08e2db8b9eba 100644\n--- a/packages/next/src/server/next-server.ts\n+++ b/packages/next/src/server/next-server.ts\n@@ -161,7 +161,7 @@ function getMiddlewareMatcher(\n }\n \n function installProcessErrorHandlers(\n- shouldRemoveUnhandledRejectionListeners: boolean\n+ shouldRemoveUncaughtErrorAndRejectionListeners: boolean\n ) {\n // The conventional wisdom of Node.js and other runtimes is to treat\n // unhandled errors as fatal and exit the process.\n@@ -199,11 +199,12 @@ function installProcessErrorHandlers(\n // So, we're going to intentionally override the default error handling\n // behavior of the outer JS runtime to be more forgiving\n \n- // Remove any existing \"unhandledRejection\" handlers. This is gated behind\n- // an experimental flag until we've considered the impact in various\n- // deployment environments. It's possible this may always need to\n+ // Remove any existing \"unhandledRejection\" and \"uncaughtException\" handlers.\n+ // This is gated behind an experimental flag until we've considered the impact\n+ // in various deployment environments. It's possible this may always need to\n // be configurable.\n- if (shouldRemoveUnhandledRejectionListeners) {\n+ if (shouldRemoveUncaughtErrorAndRejectionListeners) {\n+ process.removeAllListeners('uncaughtException')\n process.removeAllListeners('unhandledRejection')\n }\n \n@@ -370,10 +371,10 @@ export default class NextNodeServer extends BaseServer<\n populateStaticEnv(this.nextConfig)\n }\n \n- const shouldRemoveUnhandledRejectionListeners = Boolean(\n- options.conf.experimental?.removeUnhandledRejectionListeners\n+ const shouldRemoveUncaughtErrorAndRejectionListeners = Boolean(\n+ options.conf.experimental?.removeUncaughtErrorAndRejectionListeners\n )\n- installProcessErrorHandlers(shouldRemoveUnhandledRejectionListeners)\n+ installProcessErrorHandlers(shouldRemoveUncaughtErrorAndRejectionListeners)\n }\n \n public async unstable_preloadEntries(): Promise {\n"},"modified_context":{"kind":"string","value":"diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts\nindex 463d270953f4f..6db12ca87290e 100644\n--- a/packages/next/src/server/config-schema.ts\n+++ b/packages/next/src/server/config-schema.ts\n@@ -390,7 +390,7 @@ export const configSchema: zod.ZodType = z.lazy(() =>\n prerenderEarlyExit: z.boolean().optional(),\n proxyTimeout: z.number().gte(0).optional(),\n routerBFCache: z.boolean().optional(),\n- removeUnhandledRejectionListeners: z.boolean().optional(),\n+ removeUncaughtErrorAndRejectionListeners: z.boolean().optional(),\n scrollRestoration: z.boolean().optional(),\n sri: z\n .object({\ndiff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts\nindex b975d18039f3c..fc8c63442106b 100644\n--- a/packages/next/src/server/config-shared.ts\n+++ b/packages/next/src/server/config-shared.ts\n@@ -510,14 +510,14 @@ export interface ExperimentalConfig {\n routerBFCache?: boolean\n /**\n- * Uninstalls all \"unhandledRejection\" listeners from the global process so\n- * that we can override the behavior, which in some runtimes is to exit the\n- * process on an unhandled rejection.\n+ * Uninstalls all \"unhandledRejection\" and \"uncaughtException\" listeners from\n+ * the global process so that we can override the behavior, which in some\n+ * runtimes is to exit the process.\n *\n * This is experimental until we've considered the impact in various\n * deployment environments.\n */\n- removeUnhandledRejectionListeners?: boolean\n+ removeUncaughtErrorAndRejectionListeners?: boolean\n serverActions?: {\n /**\n@@ -1312,7 +1312,7 @@ export const defaultConfig: NextConfig = {\n useEarlyImport: false,\n viewTransition: false,\n routerBFCache: false,\n+ removeUncaughtErrorAndRejectionListeners: false,\n staleTimes: {\n dynamic: 0,\n static: 300,\ndiff --git a/packages/next/src/server/next-server.ts b/packages/next/src/server/next-server.ts\nindex a66633b09efee..a08e2db8b9eba 100644\n--- a/packages/next/src/server/next-server.ts\n+++ b/packages/next/src/server/next-server.ts\n@@ -161,7 +161,7 @@ function getMiddlewareMatcher(\n }\n function installProcessErrorHandlers(\n- shouldRemoveUnhandledRejectionListeners: boolean\n+ shouldRemoveUncaughtErrorAndRejectionListeners: boolean\n ) {\n // The conventional wisdom of Node.js and other runtimes is to treat\n // unhandled errors as fatal and exit the process.\n@@ -199,11 +199,12 @@ function installProcessErrorHandlers(\n // So, we're going to intentionally override the default error handling\n // behavior of the outer JS runtime to be more forgiving\n- // Remove any existing \"unhandledRejection\" handlers. This is gated behind\n- // deployment environments. It's possible this may always need to\n+ // Remove any existing \"unhandledRejection\" and \"uncaughtException\" handlers.\n+ // This is gated behind an experimental flag until we've considered the impact\n+ // in various deployment environments. It's possible this may always need to\n // be configurable.\n- if (shouldRemoveUnhandledRejectionListeners) {\n+ if (shouldRemoveUncaughtErrorAndRejectionListeners) {\n+ process.removeAllListeners('uncaughtException')\n process.removeAllListeners('unhandledRejection')\n@@ -370,10 +371,10 @@ export default class NextNodeServer extends BaseServer<\n populateStaticEnv(this.nextConfig)\n }\n- const shouldRemoveUnhandledRejectionListeners = Boolean(\n- options.conf.experimental?.removeUnhandledRejectionListeners\n+ const shouldRemoveUncaughtErrorAndRejectionListeners = Boolean(\n+ options.conf.experimental?.removeUncaughtErrorAndRejectionListeners\n )\n- installProcessErrorHandlers(shouldRemoveUnhandledRejectionListeners)\n+ installProcessErrorHandlers(shouldRemoveUncaughtErrorAndRejectionListeners)\n public async unstable_preloadEntries(): Promise {"},"omitted_context":{"kind":"list like","value":["- removeUnhandledRejectionListeners: false,","- // an experimental flag until we've considered the impact in various"],"string":"[\n \"- removeUnhandledRejectionListeners: false,\",\n \"- // an experimental flag until we've considered the impact in various\"\n]"},"omitted_index":{"kind":"list like","value":[40,63],"string":"[\n 40,\n 63\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 15,\n \"author\": \"acdlite\",\n \"deletions\": 14,\n \"html_url\": \"https://github.com/vercel/next.js/pull/78042\",\n \"issue_id\": 78042,\n \"merged_at\": \"2025-04-10T23:09:38Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 78042,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Uninstall existing uncaughtException listeners to prevent the process from crashing\",\n \"total_changes\": 29\n}"}}},{"rowIdx":323,"cells":{"id":{"kind":"number","value":323,"string":"323"},"original_context":{"kind":"string","value":"diff --git a/test/e2e/app-dir/rsc-basic/rsc-basic-react-experimental.test.ts b/test/e2e/app-dir/rsc-basic/rsc-basic-react-experimental.test.ts\nnew file mode 100644\nindex 0000000000000..4826f9ebc34e0\n--- /dev/null\n+++ b/test/e2e/app-dir/rsc-basic/rsc-basic-react-experimental.test.ts\n@@ -0,0 +1,76 @@\n+import { nextTestSetup } from 'e2e-utils'\n+\n+describe('react@experimental', () => {\n+ const { next } = nextTestSetup({\n+ files: __dirname,\n+ overrideFiles: {\n+ 'next.config.js': `\n+ module.exports = {\n+ experimental: {\n+ taint: true,\n+ }\n+ }\n+ `,\n+ },\n+ })\n+\n+ it('should opt into the react@experimental when enabling $flag', async () => {\n+ const resPages$ = await next.render$('/app-react')\n+ const [\n+ ssrReact,\n+ ssrReactDOM,\n+ ssrClientReact,\n+ ssrClientReactDOM,\n+ ssrClientReactDOMServer,\n+ ] = [\n+ resPages$('#react').text(),\n+ resPages$('#react-dom').text(),\n+ resPages$('#client-react').text(),\n+ resPages$('#client-react-dom').text(),\n+ resPages$('#client-react-dom-server').text(),\n+ ]\n+ expect({\n+ ssrReact,\n+ ssrReactDOM,\n+ ssrClientReact,\n+ ssrClientReactDOM,\n+ ssrClientReactDOMServer,\n+ }).toEqual({\n+ ssrReact: expect.stringMatching('-experimental-'),\n+ ssrReactDOM: expect.stringMatching('-experimental-'),\n+ ssrClientReact: expect.stringMatching('-experimental-'),\n+ ssrClientReactDOM: expect.stringMatching('-experimental-'),\n+ ssrClientReactDOMServer: expect.stringMatching('-experimental-'),\n+ })\n+\n+ const browser = await next.browser('/app-react')\n+ const [\n+ browserReact,\n+ browserReactDOM,\n+ browserClientReact,\n+ browserClientReactDOM,\n+ browserClientReactDOMServer,\n+ ] = await browser.eval(`\n+ [\n+ document.querySelector('#react').innerText,\n+ document.querySelector('#react-dom').innerText,\n+ document.querySelector('#client-react').innerText,\n+ document.querySelector('#client-react-dom').innerText,\n+ document.querySelector('#client-react-dom-server').innerText,\n+ ]\n+ `)\n+ expect({\n+ browserReact,\n+ browserReactDOM,\n+ browserClientReact,\n+ browserClientReactDOM,\n+ browserClientReactDOMServer,\n+ }).toEqual({\n+ browserReact: expect.stringMatching('-experimental-'),\n+ browserReactDOM: expect.stringMatching('-experimental-'),\n+ browserClientReact: expect.stringMatching('-experimental-'),\n+ browserClientReactDOM: expect.stringMatching('-experimental-'),\n+ browserClientReactDOMServer: expect.stringMatching('-experimental-'),\n+ })\n+ })\n+})\ndiff --git a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts\nindex 2df3252119e5c..46a52b0d180b3 100644\n--- a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts\n+++ b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts\n@@ -621,84 +621,4 @@ describe('app dir - rsc basics', () => {\n await Promise.all(promises)\n })\n }\n-\n- describe('react@experimental', () => {\n- it.each([{ flag: 'ppr' }, { flag: 'taint' }])(\n- 'should opt into the react@experimental when enabling $flag',\n- async ({ flag }) => {\n- await next.stop()\n- await next.patchFile(\n- 'next.config.js',\n- `\n- module.exports = {\n- experimental: {\n- ${flag}: true\n- }\n- }\n- `,\n- async () => {\n- await next.start()\n- const resPages$ = await next.render$('/app-react')\n- const [\n- ssrReact,\n- ssrReactDOM,\n- ssrClientReact,\n- ssrClientReactDOM,\n- ssrClientReactDOMServer,\n- ] = [\n- resPages$('#react').text(),\n- resPages$('#react-dom').text(),\n- resPages$('#client-react').text(),\n- resPages$('#client-react-dom').text(),\n- resPages$('#client-react-dom-server').text(),\n- ]\n- expect({\n- ssrReact,\n- ssrReactDOM,\n- ssrClientReact,\n- ssrClientReactDOM,\n- ssrClientReactDOMServer,\n- }).toEqual({\n- ssrReact: expect.stringMatching('-experimental-'),\n- ssrReactDOM: expect.stringMatching('-experimental-'),\n- ssrClientReact: expect.stringMatching('-experimental-'),\n- ssrClientReactDOM: expect.stringMatching('-experimental-'),\n- ssrClientReactDOMServer: expect.stringMatching('-experimental-'),\n- })\n-\n- const browser = await next.browser('/app-react')\n- const [\n- browserReact,\n- browserReactDOM,\n- browserClientReact,\n- browserClientReactDOM,\n- browserClientReactDOMServer,\n- ] = await browser.eval(`\n- [\n- document.querySelector('#react').innerText,\n- document.querySelector('#react-dom').innerText,\n- document.querySelector('#client-react').innerText,\n- document.querySelector('#client-react-dom').innerText,\n- document.querySelector('#client-react-dom-server').innerText,\n- ]\n- `)\n- expect({\n- browserReact,\n- browserReactDOM,\n- browserClientReact,\n- browserClientReactDOM,\n- browserClientReactDOMServer,\n- }).toEqual({\n- browserReact: expect.stringMatching('-experimental-'),\n- browserReactDOM: expect.stringMatching('-experimental-'),\n- browserClientReact: expect.stringMatching('-experimental-'),\n- browserClientReactDOM: expect.stringMatching('-experimental-'),\n- browserClientReactDOMServer:\n- expect.stringMatching('-experimental-'),\n- })\n- }\n- )\n- }\n- )\n- })\n })\n"},"modified_context":{"kind":"string","value":"diff --git a/test/e2e/app-dir/rsc-basic/rsc-basic-react-experimental.test.ts b/test/e2e/app-dir/rsc-basic/rsc-basic-react-experimental.test.ts\nnew file mode 100644\nindex 0000000000000..4826f9ebc34e0\n--- /dev/null\n+++ b/test/e2e/app-dir/rsc-basic/rsc-basic-react-experimental.test.ts\n@@ -0,0 +1,76 @@\n+import { nextTestSetup } from 'e2e-utils'\n+ const { next } = nextTestSetup({\n+ files: __dirname,\n+ overrideFiles: {\n+ module.exports = {\n+ experimental: {\n+ taint: true,\n+ }\n+ `,\n+ },\n+ it('should opt into the react@experimental when enabling $flag', async () => {\n+ const resPages$ = await next.render$('/app-react')\n+ resPages$('#react').text(),\n+ resPages$('#react-dom').text(),\n+ resPages$('#client-react-dom').text(),\n+ resPages$('#client-react-dom-server').text(),\n+ ]\n+ ssrReact: expect.stringMatching('-experimental-'),\n+ ssrReactDOM: expect.stringMatching('-experimental-'),\n+ ssrClientReact: expect.stringMatching('-experimental-'),\n+ ssrClientReactDOM: expect.stringMatching('-experimental-'),\n+ ssrClientReactDOMServer: expect.stringMatching('-experimental-'),\n+ const browser = await next.browser('/app-react')\n+ ] = await browser.eval(`\n+ [\n+ document.querySelector('#react').innerText,\n+ document.querySelector('#react-dom').innerText,\n+ document.querySelector('#client-react').innerText,\n+ document.querySelector('#client-react-dom').innerText,\n+ document.querySelector('#client-react-dom-server').innerText,\n+ ]\n+ `)\n+ browserReact: expect.stringMatching('-experimental-'),\n+ browserReactDOM: expect.stringMatching('-experimental-'),\n+ browserClientReact: expect.stringMatching('-experimental-'),\n+ browserClientReactDOM: expect.stringMatching('-experimental-'),\n+ browserClientReactDOMServer: expect.stringMatching('-experimental-'),\n+})\ndiff --git a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts\nindex 2df3252119e5c..46a52b0d180b3 100644\n--- a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts\n+++ b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts\n@@ -621,84 +621,4 @@ describe('app dir - rsc basics', () => {\n await Promise.all(promises)\n })\n }\n- describe('react@experimental', () => {\n- it.each([{ flag: 'ppr' }, { flag: 'taint' }])(\n- async ({ flag }) => {\n- await next.stop()\n- await next.patchFile(\n- 'next.config.js',\n- `\n- module.exports = {\n- experimental: {\n- ${flag}: true\n- }\n- `,\n- await next.start()\n- const resPages$ = await next.render$('/app-react')\n- ] = [\n- resPages$('#react').text(),\n- resPages$('#react-dom').text(),\n- resPages$('#client-react-dom').text(),\n- resPages$('#client-react-dom-server').text(),\n- ]\n- ssrReact: expect.stringMatching('-experimental-'),\n- ssrReactDOM: expect.stringMatching('-experimental-'),\n- ssrClientReact: expect.stringMatching('-experimental-'),\n- ssrClientReactDOM: expect.stringMatching('-experimental-'),\n- ssrClientReactDOMServer: expect.stringMatching('-experimental-'),\n- const browser = await next.browser('/app-react')\n- ] = await browser.eval(`\n- document.querySelector('#react').innerText,\n- document.querySelector('#react-dom').innerText,\n- document.querySelector('#client-react').innerText,\n- document.querySelector('#client-react-dom').innerText,\n- document.querySelector('#client-react-dom-server').innerText,\n- ]\n- `)\n- browserReact: expect.stringMatching('-experimental-'),\n- browserClientReact: expect.stringMatching('-experimental-'),\n- browserClientReactDOM: expect.stringMatching('-experimental-'),\n- browserClientReactDOMServer:\n- expect.stringMatching('-experimental-'),\n- )\n- }\n- )\n- })\n })"},"omitted_context":{"kind":"list like","value":["+describe('react@experimental', () => {","+ 'next.config.js': `","+ }","+ ] = [","+ resPages$('#client-react').text(),","- 'should opt into the react@experimental when enabling $flag',","- async () => {","- resPages$('#client-react').text(),","- [","- browserReactDOM: expect.stringMatching('-experimental-'),"],"string":"[\n \"+describe('react@experimental', () => {\",\n \"+ 'next.config.js': `\",\n \"+ }\",\n \"+ ] = [\",\n \"+ resPages$('#client-react').text(),\",\n \"- 'should opt into the react@experimental when enabling $flag',\",\n \"- async () => {\",\n \"- resPages$('#client-react').text(),\",\n \"- [\",\n \"- browserReactDOM: expect.stringMatching('-experimental-'),\"\n]"},"omitted_index":{"kind":"list like","value":[8,12,17,30,33,93,105,117,143,159],"string":"[\n 8,\n 12,\n 17,\n 30,\n 33,\n 93,\n 105,\n 117,\n 143,\n 159\n]"},"metadata":{"kind":"string","value":"{\n \"additions\": 76,\n \"author\": \"huozhi\",\n \"deletions\": 80,\n \"html_url\": \"https://github.com/vercel/next.js/pull/78038\",\n \"issue_id\": 78038,\n \"merged_at\": \"2025-04-10T23:36:20Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 78038,\n \"repo\": \"vercel/next.js\",\n \"title\": \"[test] separate rsc-basic tests\",\n \"total_changes\": 156\n}"}}},{"rowIdx":324,"cells":{"id":{"kind":"number","value":324,"string":"324"},"original_context":{"kind":"string","value":"diff --git a/docs/01-app/03-building-your-application/07-configuring/index.mdx b/docs/01-app/03-building-your-application/07-configuring/index.mdx\ndeleted file mode 100644\nindex 1cbae5fdfb266..0000000000000\n--- a/docs/01-app/03-building-your-application/07-configuring/index.mdx\n+++ /dev/null\n@@ -1,8 +0,0 @@\n----\n-title: Configuring\n-description: Learn how to configure your Next.js application.\n----\n-\n-{/* The content of this doc is shared between the app and pages router. You can use the `Content` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}\n-\n-Next.js allows you to customize your project to meet specific requirements. This includes integrations with TypeScript, ESlint, and more, as well as internal configuration options such as Absolute Imports and Environment Variables.\ndiff --git a/docs/01-app/03-building-your-application/index.mdx b/docs/01-app/03-building-your-application/index.mdx\nindex e71ad3eeb3c0b..75945ccf1f360 100644\n--- a/docs/01-app/03-building-your-application/index.mdx\n+++ b/docs/01-app/03-building-your-application/index.mdx\n@@ -11,7 +11,7 @@ The sections and pages are organized sequentially, from basic to advanced, so yo\n \n \n \n-If you're new to Next.js, we recommend starting with the [Routing](/docs/app/building-your-application/routing), [Rendering](/docs/app/building-your-application/rendering), [Data Fetching](/docs/app/building-your-application/data-fetching) and [Styling](/docs/app/building-your-application/styling) sections, as they introduce the fundamental Next.js and web concepts to help you get started. Then, you can dive deeper into the other sections such as [Optimizing](/docs/app/building-your-application/optimizing) and [Configuring](/docs/app/building-your-application/configuring). Finally, once you're ready, checkout the [Deploying](/docs/app/getting-started/deploying) and [Upgrading](/docs/app/guides/upgrading) sections.\n+If you're new to Next.js, we recommend starting with the [Routing](/docs/app/building-your-application/routing), [Rendering](/docs/app/building-your-application/rendering), [Data Fetching](/docs/app/building-your-application/data-fetching) and [Styling](/docs/app/building-your-application/styling) sections, as they introduce the fundamental Next.js and web concepts to help you get started. Then, you can dive deeper into the other sections such as [Optimizing](/docs/app/building-your-application/optimizing). Finally, once you're ready, checkout the [Deploying](/docs/app/getting-started/deploying) and [Upgrading](/docs/app/guides/upgrading) sections.\n \n \n \ndiff --git a/docs/02-pages/03-building-your-application/06-configuring/index.mdx b/docs/02-pages/03-building-your-application/06-configuring/index.mdx\nindex c903a16a33233..326ea00a21513 100644\n--- a/docs/02-pages/03-building-your-application/06-configuring/index.mdx\n+++ b/docs/02-pages/03-building-your-application/06-configuring/index.mdx\n@@ -1,7 +1,6 @@\n ---\n title: Configuring\n description: Learn how to configure your Next.js application.\n-source: app/building-your-application/configuring\n ---\n \n-{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `Content` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}\n+Next.js allows you to customize your project to meet specific requirements. This includes integrations with TypeScript, ESlint, and more, as well as internal configuration options such as Absolute Imports and Environment Variables.\n"},"modified_context":{"kind":"string","value":"diff --git a/docs/01-app/03-building-your-application/07-configuring/index.mdx b/docs/01-app/03-building-your-application/07-configuring/index.mdx\ndeleted file mode 100644\nindex 1cbae5fdfb266..0000000000000\n--- a/docs/01-app/03-building-your-application/07-configuring/index.mdx\n+++ /dev/null\n@@ -1,8 +0,0 @@\n-title: Configuring\n-description: Learn how to configure your Next.js application.\n-{/* The content of this doc is shared between the app and pages router. You can use the `Content` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}\n-Next.js allows you to customize your project to meet specific requirements. This includes integrations with TypeScript, ESlint, and more, as well as internal configuration options such as Absolute Imports and Environment Variables.\ndiff --git a/docs/01-app/03-building-your-application/index.mdx b/docs/01-app/03-building-your-application/index.mdx\nindex e71ad3eeb3c0b..75945ccf1f360 100644\n--- a/docs/01-app/03-building-your-application/index.mdx\n+++ b/docs/01-app/03-building-your-application/index.mdx\n@@ -11,7 +11,7 @@ The sections and pages are organized sequentially, from basic to advanced, so yo\n \n-If you're new to Next.js, we recommend starting with the [Routing](/docs/app/building-your-application/routing), [Rendering](/docs/app/building-your-application/rendering), [Data Fetching](/docs/app/building-your-application/data-fetching) and [Styling](/docs/app/building-your-application/styling) sections, as they introduce the fundamental Next.js and web concepts to help you get started. Then, you can dive deeper into the other sections such as [Optimizing](/docs/app/building-your-application/optimizing) and [Configuring](/docs/app/building-your-application/configuring). Finally, once you're ready, checkout the [Deploying](/docs/app/getting-started/deploying) and [Upgrading](/docs/app/guides/upgrading) sections.\n+If you're new to Next.js, we recommend starting with the [Routing](/docs/app/building-your-application/routing), [Rendering](/docs/app/building-your-application/rendering), [Data Fetching](/docs/app/building-your-application/data-fetching) and [Styling](/docs/app/building-your-application/styling) sections, as they introduce the fundamental Next.js and web concepts to help you get started. Then, you can dive deeper into the other sections such as [Optimizing](/docs/app/building-your-application/optimizing). Finally, once you're ready, checkout the [Deploying](/docs/app/getting-started/deploying) and [Upgrading](/docs/app/guides/upgrading) sections.\n \ndiff --git a/docs/02-pages/03-building-your-application/06-configuring/index.mdx b/docs/02-pages/03-building-your-application/06-configuring/index.mdx\nindex c903a16a33233..326ea00a21513 100644\n--- a/docs/02-pages/03-building-your-application/06-configuring/index.mdx\n+++ b/docs/02-pages/03-building-your-application/06-configuring/index.mdx\n@@ -1,7 +1,6 @@\n title: Configuring\n description: Learn how to configure your Next.js application.\n-source: app/building-your-application/configuring\n-{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `Content` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}\n+Next.js allows you to customize your project to meet specific requirements. This includes integrations with TypeScript, ESlint, and more, as well as internal configuration options such as Absolute Imports and Environment Variables."},"omitted_context":{"kind":"list like","value":[],"string":"[]"},"omitted_index":{"kind":"list like","value":[],"string":"[]"},"metadata":{"kind":"string","value":"{\n \"additions\": 2,\n \"author\": \"delbaoliveira\",\n \"deletions\": 9,\n \"html_url\": \"https://github.com/vercel/next.js/pull/78521\",\n \"issue_id\": 78521,\n \"merged_at\": \"2025-04-24T19:08:34Z\",\n \"omission_probability\": 0.1,\n \"pr_number\": 78521,\n \"repo\": \"vercel/next.js\",\n \"title\": \"Docs IA 2.0: Delete config page in app docs\",\n \"total_changes\": 11\n}"}}},{"rowIdx":325,"cells":{"id":{"kind":"number","value":325,"string":"325"},"original_context":{"kind":"string","value":"diff --git a/docs/01-app/01-getting-started/02-project-structure.mdx b/docs/01-app/01-getting-started/02-project-structure.mdx\nindex 085745f2137d4..bf1931022b151 100644\n--- a/docs/01-app/01-getting-started/02-project-structure.mdx\n+++ b/docs/01-app/01-getting-started/02-project-structure.mdx\n@@ -31,22 +31,22 @@ Top-level folders are used to organize your application's code and static assets\n \n Top-level files are used to configure your application, manage dependencies, run middleware, integrate monitoring tools, and define environment variables.\n \n-| | |\n-| -------------------------------------------------------------------------------------- | --------------------------------------- |\n-| **Next.js** | |\n-| [`next.config.js`](/docs/app/api-reference/config/next-config-js) | Configuration file for Next.js |\n-| [`package.json`](/docs/app/getting-started/installation#manual-installation) | Project dependencies and scripts |\n-| [`instrumentation.ts`](/docs/app/building-your-application/optimizing/instrumentation) | OpenTelemetry and Instrumentation file |\n-| [`middleware.ts`](/docs/app/building-your-application/routing/middleware) | Next.js request middleware |\n-| [`.env`](/docs/app/guides/environment-variables) | Environment variables |\n-| [`.env.local`](/docs/app/guides/environment-variables) | Local environment variables |\n-| [`.env.production`](/docs/app/guides/environment-variables) | Production environment variables |\n-| [`.env.development`](/docs/app/guides/environment-variables) | Development environment variables |\n-| [`.eslintrc.json`](/docs/app/api-reference/config/eslint) | Configuration file for ESLint |\n-| `.gitignore` | Git files and folders to ignore |\n-| `next-env.d.ts` | TypeScript declaration file for Next.js |\n-| `tsconfig.json` | Configuration file for TypeScript |\n-| `jsconfig.json` | Configuration file for JavaScript |\n+| | |\n+| ---------------------------------------------------------------------------- | --------------------------------------- |\n+| **Next.js** | |\n+| [`next.config.js`](/docs/app/api-reference/config/next-config-js) | Configuration file for Next.js |\n+| [`package.json`](/docs/app/getting-started/installation#manual-installation) | Project dependencies and scripts |\n+| [`instrumentation.ts`](/docs/app/guides/instrumentation) | OpenTelemetry and Instrumentation file |\n+| [`middleware.ts`](/docs/app/building-your-application/routing/middleware) | Next.js request middleware |\n+| [`.env`](/docs/app/guides/environment-variables) | Environment variables |\n+| [`.env.local`](/docs/app/guides/environment-variables) | Local environment variables |\n+| [`.env.production`](/docs/app/guides/environment-variables) | Production environment variables |\n+| [`.env.development`](/docs/app/guides/environment-variables) | Development environment variables |\n+| [`.eslintrc.json`](/docs/app/api-reference/config/eslint) | Configuration file for ESLint |\n+| `.gitignore` | Git files and folders to ignore |\n+| `next-env.d.ts` | TypeScript declaration file for Next.js |\n+| `tsconfig.json` | Configuration file for TypeScript |\n+| `jsconfig.json` | Configuration file for JavaScript |\n \n \n \ndiff --git a/docs/01-app/03-building-your-application/06-optimizing/08-analytics.mdx b/docs/01-app/02-guides/analytics.mdx\nsimilarity index 93%\nrename from docs/01-app/03-building-your-application/06-optimizing/08-analytics.mdx\nrename to docs/01-app/02-guides/analytics.mdx\nindex 49ff948349a07..0cdf80fe9196b 100644\n--- a/docs/01-app/03-building-your-application/06-optimizing/08-analytics.mdx\n+++ b/docs/01-app/02-guides/analytics.mdx\n@@ -1,11 +1,12 @@\n ---\n-title: Analytics\n+title: How to add analytics to your Next.js application\n+nav_title: Analytics\n description: Measure and track page performance using Next.js Speed Insights\n ---\n \n {/* The content of this doc is shared between the app and pages router. You can use the `Content` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}\n \n-Next.js has built-in support for measuring and reporting performance metrics. You can either use the `useReportWebVitals` hook to manage reporting yourself, or alternatively, Vercel provides a [managed service](https://vercel.com/analytics?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) to automatically collect and visualize metrics for you.\n+Next.js has built-in support for measuring and reporting performance metrics. You can either use the [`useReportWebVitals`](/docs/app/api-reference/functions/use-report-web-vitals) hook to manage reporting yourself, or alternatively, Vercel provides a [managed service](https://vercel.com/analytics?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) to automatically collect and visualize metrics for you.\n \n ## Client Instrumentation\n \ndiff --git a/docs/01-app/02-guides/environment-variables.mdx b/docs/01-app/02-guides/environment-variables.mdx\nindex e6bd12e2f1943..6e4489c6adcbe 100644\n--- a/docs/01-app/02-guides/environment-variables.mdx\n+++ b/docs/01-app/02-guides/environment-variables.mdx\n@@ -227,7 +227,7 @@ This allows you to use a singular Docker image that can be promoted through mult\n \n **Good to know:**\n \n-- You can run code on server startup using the [`register` function](/docs/app/building-your-application/optimizing/instrumentation).\n+- You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation).\n - We do not recommend using the [`runtimeConfig`](/docs/pages/api-reference/config/next-config-js/runtime-configuration) option, as this does not work with the standalone output mode. Instead, we recommend [incrementally adopting](/docs/app/guides/migrating/app-router-migration) the App Router if you need this feature.\n \n ## Environment Variables on Vercel\ndiff --git a/docs/01-app/03-building-your-application/06-optimizing/09-instrumentation.mdx b/docs/01-app/02-guides/instrumentation.mdx\nsimilarity index 98%\nrename from docs/01-app/03-building-your-application/06-optimizing/09-instrumentation.mdx\nrename to docs/01-app/02-guides/instrumentation.mdx\nindex d4bc45bffbf2b..86a6b538b0dc8 100644\n--- a/docs/01-app/03-building-your-application/06-optimizing/09-instrumentation.mdx\n+++ b/docs/01-app/02-guides/instrumentation.mdx\n@@ -1,5 +1,6 @@\n ---\n-title: Instrumentation\n+title: How to set up instrumentation\n+nav_title: Instrumentation\n description: Learn how to use instrumentation to run code at server startup in your Next.js app\n related:\n title: Learn more about Instrumentation\ndiff --git a/docs/01-app/03-building-your-application/06-optimizing/07-lazy-loading.mdx b/docs/01-app/02-guides/lazy-loading.mdx\nsimilarity index 99%\nrename from docs/01-app/03-building-your-application/06-optimizing/07-lazy-loading.mdx\nrename to docs/01-app/02-guides/lazy-loading.mdx\nindex 9c98f4c15563a..4e0b477a0cc76 100644\n--- a/docs/01-app/03-building-your-application/06-optimizing/07-lazy-loading.mdx\n+++ b/docs/01-app/02-guides/lazy-loading.mdx\n@@ -1,5 +1,6 @@\n ---\n-title: Lazy Loading\n+title: How to lazy load Client Components and libraries\n+nav_title: Lazy Loading\n description: Lazy load imported libraries and React Components to improve your application's loading performance.\n ---\n \ndiff --git a/docs/01-app/03-building-your-application/06-optimizing/14-local-development.mdx b/docs/01-app/02-guides/local-development.mdx\nsimilarity index 95%\nrename from docs/01-app/03-building-your-application/06-optimizing/14-local-development.mdx\nrename to docs/01-app/02-guides/local-development.mdx\nindex 35e2b9a191140..c09a43a7a2ef5 100644\n--- a/docs/01-app/03-building-your-application/06-optimizing/14-local-development.mdx\n+++ b/docs/01-app/02-guides/local-development.mdx\n@@ -1,5 +1,6 @@\n ---\n-title: Local Development\n+title: How to optimize your local development environment\n+nav_title: Development Environment\n description: Learn how to optimize your local development environment with Next.js.\n ---\n \n@@ -34,7 +35,7 @@ npm run dev --turbopack\n \n ### 3. Check your imports\n \n-The way you import code can greatly affect compilation and bundling time. Learn more about [optimizing package bundling](/docs/app/building-your-application/optimizing/package-bundling) and explore tools like [Dependency Cruiser](https://github.com/sverweij/dependency-cruiser) or [Madge](https://github.com/pahen/madge).\n+The way you import code can greatly affect compilation and bundling time. Learn more about [optimizing package bundling](/docs/app/guides/package-bundling) and explore tools like [Dependency Cruiser](https://github.com/sverweij/dependency-cruiser) or [Madge](https://github.com/pahen/madge).\n \n ### Icon libraries\n \n@@ -122,7 +123,7 @@ Consider if you really need them for local development. You can optionally only\n \n If your app is very large, it might need more memory.\n \n-[Learn more about optimizing memory usage](/docs/app/building-your-application/optimizing/memory-usage).\n+[Learn more about optimizing memory usage](/docs/app/guides/memory-usage).\n \n ### 7. Server Components and data fetching\n \ndiff --git a/docs/01-app/03-building-your-application/06-optimizing/13-memory-usage.mdx b/docs/01-app/02-guides/memory-usage.mdx\nsimilarity index 96%\nrename from docs/01-app/03-building-your-application/06-optimizing/13-memory-usage.mdx\nrename to docs/01-app/02-guides/memory-usage.mdx\nindex 46011e262c17c..d625c3b342155 100644\n--- a/docs/01-app/03-building-your-application/06-optimizing/13-memory-usage.mdx\n+++ b/docs/01-app/02-guides/memory-usage.mdx\n@@ -1,5 +1,6 @@\n ---\n-title: Memory Usage\n+title: How to optimize memory usage\n+nav_title: Memory Usage\n description: Optimize memory used by your application in development and production.\n ---\n \n@@ -11,7 +12,7 @@ Let's explore some strategies and techniques to optimize memory and address comm\n \n Applications with a large amount of dependencies will use more memory.\n \n-The [Bundle Analyzer](/docs/app/building-your-application/optimizing/package-bundling) can help you investigate large dependencies in your application that may be able to be removed to improve performance and memory usage.\n+The [Bundle Analyzer](/docs/app/guides/package-bundling) can help you investigate large dependencies in your application that may be able to be removed to improve performance and memory usage.\n \n ## Try `experimental.webpackMemoryOptimizations`\n \ndiff --git a/docs/01-app/02-guides/migrating/from-create-react-app.mdx b/docs/01-app/02-guides/migrating/from-create-react-app.mdx\nindex e7cf97f761a1c..348bccc1c893f 100644\n--- a/docs/01-app/02-guides/migrating/from-create-react-app.mdx\n+++ b/docs/01-app/02-guides/migrating/from-create-react-app.mdx\n@@ -43,7 +43,7 @@ Depending on your needs, Next.js allows you to choose your data fetching strateg\n \n ### Built-in Optimizations\n \n-[Images](/docs/app/building-your-application/optimizing/images), [fonts](/docs/app/building-your-application/optimizing/fonts), and [third-party scripts](/docs/app/building-your-application/optimizing/scripts) often have a large impact on an application’s performance. Next.js includes specialized components and APIs that automatically optimize them for you.\n+[Images](/docs/app/building-your-application/optimizing/images), [fonts](/docs/app/building-your-application/optimizing/fonts), and [third-party scripts](/docs/app/guides/scripts) often have a large impact on an application’s performance. Next.js includes specialized components and APIs that automatically optimize them for you.\n \n ## Migration Steps\n \n@@ -575,7 +575,7 @@ If everything worked, you now have a functioning Next.js application running as\n - [React Server Components](/docs/app/building-your-application/rendering/server-components)\n - **Optimize images** with the [`` component](/docs/app/building-your-application/optimizing/images)\n - **Optimize fonts** with [`next/font`](/docs/app/building-your-application/optimizing/fonts)\n-- **Optimize third-party scripts** with the [`