Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
feedthejim committed Feb 1, 2023
1 parent 40f06d5 commit 5bb4c49
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions packages/next/src/build/webpack-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Rewrite } from '../lib/load-custom-routes'
import { NextConfigComplete } from '../server/config-shared'
import { MiddlewareMatcher } from './analysis/get-page-static-info'
import { NextBuildContext } from '.'
import { CreateEntrypointsParams, createEntrypoints } from './entries'

type CompilerResult = {
errors: webpack.StatsError[]
Expand All @@ -34,21 +35,24 @@ function isTelemetryPlugin(plugin: unknown): plugin is TelemetryPlugin {
return plugin instanceof TelemetryPlugin
}

export async function webpackBuild(commonWebpackOptions: {
buildId: string
config: NextConfigComplete
pagesDir: string | undefined
reactProductionProfiling: boolean
rewrites: {
fallback: Rewrite[]
afterFiles: Rewrite[]
beforeFiles: Rewrite[]
}
target: string
appDir: string | undefined
noMangling: boolean
middlewareMatchers: MiddlewareMatcher[] | undefined
}): Promise<number> {
export async function webpackBuild(
commonWebpackOptions: {
buildId: string
config: NextConfigComplete
pagesDir: string | undefined
reactProductionProfiling: boolean
rewrites: {
fallback: Rewrite[]
afterFiles: Rewrite[]
beforeFiles: Rewrite[]
}
target: string
appDir: string | undefined
noMangling: boolean
middlewareMatchers: MiddlewareMatcher[] | undefined
},
entrypointsParams: CreateEntrypointsParams
): Promise<number> {
let result: CompilerResult | null = {
warnings: [],
errors: [],
Expand All @@ -62,7 +66,10 @@ export async function webpackBuild(commonWebpackOptions: {
// IIFE to isolate locals and avoid retaining memory too long
const runWebpackSpan = nextBuildSpan.traceChild('run-webpack-compiler')

const entrypoints = NextBuildContext.entrypoints!
const entrypoints = await nextBuildSpan
.traceChild('create-entrypoints')
.traceAsyncFn(() => createEntrypoints(entrypointsParams))

const configs = await runWebpackSpan
.traceChild('generate-webpack-config')
.traceAsyncFn(() =>
Expand Down

0 comments on commit 5bb4c49

Please sign in to comment.