Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
feedthejim committed Jan 31, 2023
1 parent 85e8094 commit e5a9d38
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 40 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/build/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function createPagesMapping({
}
}

interface CreateEntrypointsParams {
export interface CreateEntrypointsParams {
buildId: string
config: NextConfigComplete
envFiles: LoadedEnvFiles
Expand Down
66 changes: 27 additions & 39 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
}> = {}

Expand Down Expand Up @@ -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][] = []
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit e5a9d38

Please sign in to comment.