Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Dec 20, 2024
1 parent 989dd90 commit 13107a5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 23 deletions.
12 changes: 6 additions & 6 deletions packages/next/src/build/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export function runCompiler(
}
compiler.fsStartTime = Date.now()
compiler.run((err, stats) => {
const result = runWebpackSpan
.traceChild('webpack-generate-error-stats')
.traceFn(() =>
generateStats({ errors: [], warnings: [], stats }, stats!)
)

const webpackCloseSpan = runWebpackSpan.traceChild('webpack-close', {
name: config.name || 'unknown',
})
Expand All @@ -78,12 +84,6 @@ export function runCompiler(
}
return reject(err)
} else if (!stats) throw new Error('No Stats from webpack')

const result = webpackCloseSpan
.traceChild('webpack-generate-error-stats')
.traceFn(() =>
generateStats({ errors: [], warnings: [], stats }, stats)
)
return resolve([result, compiler.inputFileSystem])
})
})
Expand Down
12 changes: 8 additions & 4 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1041,10 +1041,14 @@ export default async function getBaseWebpackConfig(
// duplication that need to be pulled out.
chunks: (chunk: any) =>
!/^(polyfills|main|pages\/_app)$/.test(chunk.name),
cacheGroups: {
framework: frameworkCacheGroup,
lib: libCacheGroup,
},

// TODO: investigate these cache groups with rspack
cacheGroups: isRspack
? {}
: {
framework: frameworkCacheGroup,
lib: libCacheGroup,
},
maxInitialRequests: 25,
minSize: 20000,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function getClientStyleLoader({

const MiniCssExtractPlugin = isRspack
? // eslint-disable-next-line
require('@rspack/core').rspack.CssExtractRspackPlugin.loader
require('@rspack/core').rspack.CssExtractRspackPlugin
: require('../../../../plugins/mini-css-extract-plugin').default

return {
Expand Down
26 changes: 14 additions & 12 deletions packages/next/src/build/webpack/plugins/build-manifest-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,18 @@ export function generateClientManifest(
compiler?: any,
compilation?: any
): string | undefined {
const compilationSpan = compilation
? spans.get(compilation)
: compiler
? spans.get(compiler)
: new Span({ name: 'client-manifest' })

const genClientManifestSpan = compilationSpan?.traceChild(
const compilationSpan =
(compilation
? spans.get(compilation)
: compiler
? spans.get(compiler)
: undefined) || new Span({ name: 'client-manifest' })

const genClientManifestSpan = compilationSpan.traceChild(
'NextJsBuildManifest-generateClientManifest'
)

return genClientManifestSpan?.traceFn(() => {
return genClientManifestSpan.traceFn(() => {
const clientManifest: ClientBuildManifest = {
__rewrites: normalizeRewritesForBuildManifest(rewrites) as any,
__routerFilterStatic: clientRouterFilters?.staticFilter as any,
Expand Down Expand Up @@ -200,10 +201,11 @@ export default class BuildManifestPlugin {

createAssets(compiler: any, compilation: any, assets: any) {
const compilationSpan = spans.get(compilation) || spans.get(compiler)
const createAssetsSpan = compilationSpan?.traceChild(
'NextJsBuildManifest-createassets'
)
return createAssetsSpan?.traceFn(() => {
const createAssetsSpan = (
compilationSpan || new Span({ name: '' })
).traceChild('NextJsBuildManifest-createassets')

return createAssetsSpan.traceFn(() => {
const entrypoints: Map<string, any> = compilation.entrypoints
const assetMap: DeepMutable<BuildManifest> = {
polyfillFiles: [],
Expand Down

0 comments on commit 13107a5

Please sign in to comment.