diff --git a/packages/next/src/build/entries.ts b/packages/next/src/build/entries.ts index 88284dd3bee39..af20875bc0fc3 100644 --- a/packages/next/src/build/entries.ts +++ b/packages/next/src/build/entries.ts @@ -133,7 +133,7 @@ export function createPagesMapping({ } } -interface CreateEntrypointsParams { +export interface CreateEntrypointsParams { buildId: string config: NextConfigComplete envFiles: LoadedEnvFiles diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 9e484ae5d6617..d2a89255ef9bb 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -1,5 +1,4 @@ import '../lib/setup-exception-listeners' -import type { webpack } from 'next/dist/compiled/webpack/webpack' import { loadEnvConfig } from '@next/env' import chalk from 'next/dist/compiled/chalk' import crypto from 'crypto' @@ -81,7 +80,7 @@ import { } from '../telemetry/events' import { Telemetry } from '../telemetry/storage' import { getPageStaticInfo } from './analysis/get-page-static-info' -import { createEntrypoints, createPagesMapping } from './entries' +import { createPagesMapping } from './entries' import { generateBuildId } from './generate-build-id' import { isWriteable } from './is-writeable' import * as Log from './output/log' @@ -149,12 +148,6 @@ export const NextBuildContext: Partial<{ telemetryPlugin: TelemetryPlugin buildSpinner: Ora nextBuildSpan: Span - entrypoints: { - client: webpack.EntryObject - server: webpack.EntryObject - edgeServer: webpack.EntryObject - middlewareMatchers: undefined - } dir: string }> = {} @@ -565,26 +558,6 @@ export default async function build( }) } - const entrypoints = await nextBuildSpan - .traceChild('create-entrypoints') - .traceAsyncFn(() => - createEntrypoints({ - buildId, - config, - envFiles: loadedEnvFiles, - isDev: false, - pages: mappedPages, - pagesDir, - previewMode: previewProps, - rootDir: dir, - rootPaths: mappedRootPaths, - appDir, - appPaths: mappedAppPages, - pageExtensions: config.pageExtensions, - }) - ) - NextBuildContext.entrypoints = entrypoints - const pagesPageKeys = Object.keys(mappedPages) const conflictingAppPagePaths: [pagePath: string, appPath: string][] = [] @@ -947,17 +920,32 @@ export default async function build( ignore: [] as string[], })) - const webpackBuildDuration = await webpackBuild({ - buildId, - config, - pagesDir, - reactProductionProfiling, - rewrites, - target, - appDir, - noMangling, - middlewareMatchers: entrypoints.middlewareMatchers, - }) + const webpackBuildDuration = await webpackBuild( + { + buildId, + config, + pagesDir, + reactProductionProfiling, + rewrites, + target, + appDir, + noMangling, + }, + { + buildId, + config, + envFiles: loadedEnvFiles, + isDev: false, + pages: mappedPages, + pagesDir, + previewMode: previewProps, + rootDir: dir, + rootPaths: mappedRootPaths, + appDir, + appPaths: mappedAppPages, + pageExtensions: config.pageExtensions, + } + ) telemetry.record( eventBuildCompleted(pagesPaths, {