Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show webpack version message in production server #25654

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions packages/next/next-server/server/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Worker } from 'jest-worker'
import * as Log from '../../build/output/log'
import { CheckReasons, CheckResult } from './config-utils-worker'
import { install, shouldLoadWithWebpack5 } from './config-utils-worker'
import { PHASE_PRODUCTION_SERVER } from '../lib/constants'

export { install, shouldLoadWithWebpack5 }

Expand Down Expand Up @@ -36,11 +37,15 @@ export async function loadWebpackHook(phase: string, dir: string) {
)
try {
const result: CheckResult = await worker.shouldLoadWithWebpack5(phase, dir)
Log.info(
`Using webpack ${result.enabled ? '5' : '4'}. Reason: ${reasonMessage(
result.reason
)} https://nextjs.org/docs/messages/webpack5`
)
// Don't log which webpack version is being used when booting production server as it's not used after build
if (phase !== PHASE_PRODUCTION_SERVER) {
Log.info(
`Using webpack ${result.enabled ? '5' : '4'}. Reason: ${reasonMessage(
result.reason
)} https://nextjs.org/docs/messages/webpack5`
)
}

useWebpack5 = Boolean(result.enabled)
} catch {
// If this errors, it likely will do so again upon boot, so we just swallow
Expand Down