diff --git a/packages/next/build/entries.ts b/packages/next/build/entries.ts index c43f1d9f8abc479..a1dafb64bf67dda 100644 --- a/packages/next/build/entries.ts +++ b/packages/next/build/entries.ts @@ -521,7 +521,7 @@ export function finalizeEntrypoint({ name !== CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH ) { // TODO-APP: this is a temporary fix. @shuding is going to change the handling of server components - if (hasAppDir && entry.import.includes('flight')) { + if (hasAppDir && entry.import.includes('next-flight-client-entry-loader')) { return { dependOn: CLIENT_STATIC_FILES_RUNTIME_MAIN_APP, ...entry, diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index c4c8c3198ef58fa..6647d7dfa022270 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -1618,7 +1618,7 @@ export default async function getBaseWebpackConfig( }, module: { rules: [ - ...(hasAppDir && !isClient && !isEdgeServer + ...(hasAppDir && !isClient ? [ { issuerLayer: WEBPACK_LAYERS.server, @@ -1643,7 +1643,7 @@ export default async function getBaseWebpackConfig( // If missing the alias override here, the default alias will be used which aliases // react to the direct file path, not the package name. In that case the condition // will be ignored completely. - react: 'next/dist/compiled/react', + react: 'next/dist/compiled/react/react.shared-subset', 'react-dom$': 'next/dist/compiled/react-dom/server-rendering-stub', }, diff --git a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts index 41c983490cdcad4..fd8a299dcd14eff 100644 --- a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts @@ -231,7 +231,7 @@ export class FlightClientEntryPlugin { function collectModule(entryName: string, mod: any) { const resource = mod.resource - const modId = resource // compilation.chunkGraph.getModuleId(mod) + '' + const modId = resource if (modId) { if (regexCSS.test(modId)) { cssImportsForChunk[entryName].push(modId) @@ -361,9 +361,8 @@ export class FlightClientEntryPlugin { !rawRequest.startsWith(APP_DIR_ALIAS) const modRequest: string | undefined = isLocal - ? rawRequest // compilation.chunkGraph.getModuleId(mod) + '' + ? rawRequest : mod.resourceResolveData?.path + mod.resourceResolveData?.query - // console.log('modId:after', modRequest) // Ensure module is not walked again if it's already been visited if (!visitedBySegment[layoutOrPageRequest]) { diff --git a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts index 81dc53caeaada02..1e63e4a4dece03a 100644 --- a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts @@ -186,10 +186,8 @@ export class FlightManifestPlugin { context, mod.resourceResolveData?.path || resource ) - // if (resource.includes('script')) - // console.log('ssrNamedModuleId', ssrNamedModuleId, modId) + if (!ssrNamedModuleId.startsWith('.')) - // TODO use getModuleId instead ssrNamedModuleId = `./${ssrNamedModuleId.replace(/\\/g, '/')}` if (isCSSModule) { diff --git a/packages/next/client/app-index.tsx b/packages/next/client/app-index.tsx index 998b71af5bb2320..fe45a3eacb35060 100644 --- a/packages/next/client/app-index.tsx +++ b/packages/next/client/app-index.tsx @@ -7,7 +7,6 @@ import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-we import measureWebVitals from './performance-relayer' import { HeadManagerContext } from '../shared/lib/head-manager-context' -import HotReload from './components/react-dev-overlay/hot-reloader-client' import { GlobalLayoutRouterContext } from '../shared/lib/app-router-context' /// @@ -178,6 +177,9 @@ export function hydrate() { if (process.env.NODE_ENV !== 'production') { const rootLayoutMissingTagsError = (self as any) .__next_root_layout_missing_tags_error + const HotReload: typeof import('./components/react-dev-overlay/hot-reloader-client').default = + require('./components/react-dev-overlay/hot-reloader-client') + .default as typeof import('./components/react-dev-overlay/hot-reloader-client').default // Don't try to hydrate if root layout is missing required tags, render error instead if (rootLayoutMissingTagsError) { diff --git a/test/.stats-app/app/app-edge-ssr/page.js b/test/.stats-app/app/app-edge-ssr/page.js index 20e49c40a12cc05..8151cdff9bd9745 100644 --- a/test/.stats-app/app/app-edge-ssr/page.js +++ b/test/.stats-app/app/app-edge-ssr/page.js @@ -2,6 +2,4 @@ export default function page() { return 'edge-ssr' } -export const config = { - runtime: 'experimental-edge', -} +export const runtime = 'experimental-edge' diff --git a/test/.stats-app/next.config.js b/test/.stats-app/next.config.js index cfa3ac3d7aa94b3..9544563de649626 100644 --- a/test/.stats-app/next.config.js +++ b/test/.stats-app/next.config.js @@ -3,3 +3,11 @@ module.exports = { appDir: true, }, } + +// For development: analyze the bundled chunks for stats app +if (process.env.ANALYZE) { + const withBundleAnalyzer = require('@next/bundle-analyzer')({ + enabled: true, + }) + module.exports = withBundleAnalyzer(module.exports) +} diff --git a/test/e2e/app-dir/back-button-download-bug/app/page.js b/test/e2e/app-dir/back-button-download-bug/app/page.js index 8b27c635f91d4f4..bbcdb0a8d9f3ae5 100644 --- a/test/e2e/app-dir/back-button-download-bug/app/page.js +++ b/test/e2e/app-dir/back-button-download-bug/app/page.js @@ -4,8 +4,8 @@ export default function Home() { return ( <>

Home!

- - To post 1 + + To post 1 To / diff --git a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic-catchall/[...slug]/page.js b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic-catchall/[...slug]/page.js index a4a02806a555ec0..5dece6d1e3e8d3e 100644 --- a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic-catchall/[...slug]/page.js +++ b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic-catchall/[...slug]/page.js @@ -4,11 +4,11 @@ export default function Page({ params }) { const nextUrl = [...params.slug, 'slug'] return ( <> - - To next url + + To next url - - To next url + + To next url

catchall {params.slug.join(' ')}