Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
ad4f5ce5
Commit
ad4f5ce5
authored
Dec 08, 2025
by
Jude Gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve ux
parent
961fb0ae
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
344 additions
and
517 deletions
+344
-517
next.ts
packages/next/src/bin/next.ts
+2
-2
build-context.ts
packages/next/src/build/build-context.ts
+1
-1
define-env.ts
packages/next/src/build/define-env.ts
+1
-1
index.ts
packages/next/src/build/index.ts
+3
-3
impl.ts
packages/next/src/build/turbopack-build/impl.ts
+1
-1
impl.ts
packages/next/src/build/webpack-build/impl.ts
+1
-1
webpack-config.ts
packages/next/src/build/webpack-config.ts
+2
-2
next-build.ts
packages/next/src/cli/next-build.ts
+5
-5
app-bootstrap.ts
packages/next/src/client/app-bootstrap.ts
+3
-3
index.tsx
packages/next/src/client/index.tsx
+3
-3
waterfall-detector.ts
packages/next/src/client/waterfall-detector.ts
+69
-298
require-instrumentation-client.ts
packages/next/src/lib/require-instrumentation-client.ts
+1
-1
config-shared.ts
packages/next/src/server/config-shared.ts
+6
-6
config.ts
packages/next/src/server/config.ts
+13
-13
app-info-log.ts
packages/next/src/server/lib/app-info-log.ts
+10
-0
start-server.ts
packages/next/src/server/lib/start-server.ts
+8
-0
next-server.ts
packages/next/src/server/next-server.ts
+215
-177
No files found.
packages/next/src/bin/next.ts
View file @
ad4f5ce5
...
@@ -187,8 +187,8 @@ program
...
@@ -187,8 +187,8 @@ program
'Comma-separated glob patterns or explicit paths for selective builds. Examples: "app/*", "app/page.tsx", "app/**/page.tsx"'
'Comma-separated glob patterns or explicit paths for selective builds. Examples: "app/*", "app/page.tsx", "app/**/page.tsx"'
)
)
.
option
(
.
option
(
'--
profiler
'
,
'--
insights
'
,
'Creates a
profiler
build with source maps enabled, no minification, and React profiling.'
'Creates a
n insights
build with source maps enabled, no minification, and React profiling.'
)
)
.
action
((
directory
:
string
,
options
:
NextBuildOptions
)
=>
{
.
action
((
directory
:
string
,
options
:
NextBuildOptions
)
=>
{
if
(
options
.
experimentalNextConfigStripTypes
)
{
if
(
options
.
experimentalNextConfigStripTypes
)
{
...
...
packages/next/src/build/build-context.ts
View file @
ad4f5ce5
...
@@ -96,5 +96,5 @@ export const NextBuildContext: Partial<{
...
@@ -96,5 +96,5 @@ export const NextBuildContext: Partial<{
isCompileMode
?:
boolean
isCompileMode
?:
boolean
debugPrerender
:
boolean
debugPrerender
:
boolean
analyze
:
boolean
analyze
:
boolean
profiler
:
boolean
insights
:
boolean
}
>
=
{}
}
>
=
{}
packages/next/src/build/define-env.ts
View file @
ad4f5ce5
...
@@ -345,7 +345,7 @@ export function getDefineEnv({
...
@@ -345,7 +345,7 @@ export function getDefineEnv({
config
.
experimental
.
reactDebugChannel
??
false
,
config
.
experimental
.
reactDebugChannel
??
false
,
'process.env.__NEXT_TRANSITION_INDICATOR'
:
'process.env.__NEXT_TRANSITION_INDICATOR'
:
config
.
experimental
.
transitionIndicator
??
false
,
config
.
experimental
.
transitionIndicator
??
false
,
'process.env.__NEXT_
PROFILER_BUILD'
:
config
.
profiler
??
false
,
'process.env.__NEXT_
INSIGHTS_BUILD'
:
config
.
insights
??
false
,
}
}
const
userDefines
=
config
.
compiler
?.
define
??
{}
const
userDefines
=
config
.
compiler
?.
define
??
{}
...
...
packages/next/src/build/index.ts
View file @
ad4f5ce5
...
@@ -891,7 +891,7 @@ export default async function build(
...
@@ -891,7 +891,7 @@ export default async function build(
traceUploadUrl
:
string
|
undefined
,
traceUploadUrl
:
string
|
undefined
,
debugBuildAppPaths
?:
string
[],
debugBuildAppPaths
?:
string
[],
debugBuildPagePaths
?:
string
[],
debugBuildPagePaths
?:
string
[],
profiler
=
false
insights
=
false
):
Promise
<
void
>
{
):
Promise
<
void
>
{
const
isCompileMode
=
experimentalBuildMode
===
'compile'
const
isCompileMode
=
experimentalBuildMode
===
'compile'
const
isGenerateMode
=
experimentalBuildMode
===
'generate'
const
isGenerateMode
=
experimentalBuildMode
===
'generate'
...
@@ -914,7 +914,7 @@ export default async function build(
...
@@ -914,7 +914,7 @@ export default async function build(
NextBuildContext
.
reactProductionProfiling
=
reactProductionProfiling
NextBuildContext
.
reactProductionProfiling
=
reactProductionProfiling
NextBuildContext
.
noMangling
=
noMangling
NextBuildContext
.
noMangling
=
noMangling
NextBuildContext
.
debugPrerender
=
debugPrerender
NextBuildContext
.
debugPrerender
=
debugPrerender
NextBuildContext
.
profiler
=
profiler
NextBuildContext
.
insights
=
insights
await
nextBuildSpan
.
traceAsyncFn
(
async
()
=>
{
await
nextBuildSpan
.
traceAsyncFn
(
async
()
=>
{
// attempt to load global env values so they are available in next.config.js
// attempt to load global env values so they are available in next.config.js
...
@@ -934,7 +934,7 @@ export default async function build(
...
@@ -934,7 +934,7 @@ export default async function build(
silent
:
false
,
silent
:
false
,
reactProductionProfiling
,
reactProductionProfiling
,
debugPrerender
,
debugPrerender
,
profiler
,
insights
,
}),
}),
turborepoAccessTraceResult
turborepoAccessTraceResult
)
)
...
...
packages/next/src/build/turbopack-build/impl.ts
View file @
ad4f5ce5
...
@@ -230,7 +230,7 @@ export async function workerMain(workerData: {
...
@@ -230,7 +230,7 @@ export async function workerMain(workerData: {
{
{
debugPrerender
:
NextBuildContext
.
debugPrerender
,
debugPrerender
:
NextBuildContext
.
debugPrerender
,
reactProductionProfiling
:
NextBuildContext
.
reactProductionProfiling
,
reactProductionProfiling
:
NextBuildContext
.
reactProductionProfiling
,
profiler
:
NextBuildContext
.
profiler
,
insights
:
NextBuildContext
.
insights
,
}
}
))
))
// Matches handling in build/index.ts
// Matches handling in build/index.ts
...
...
packages/next/src/build/webpack-build/impl.ts
View file @
ad4f5ce5
...
@@ -390,7 +390,7 @@ export async function workerMain(workerData: {
...
@@ -390,7 +390,7 @@ export async function workerMain(workerData: {
{
{
debugPrerender
:
NextBuildContext
.
debugPrerender
,
debugPrerender
:
NextBuildContext
.
debugPrerender
,
reactProductionProfiling
:
NextBuildContext
.
reactProductionProfiling
,
reactProductionProfiling
:
NextBuildContext
.
reactProductionProfiling
,
profiler
:
NextBuildContext
.
profiler
,
insights
:
NextBuildContext
.
insights
,
}
}
))
))
await
installBindings
(
config
.
experimental
?.
useWasmBinary
)
await
installBindings
(
config
.
experimental
?.
useWasmBinary
)
...
...
packages/next/src/build/webpack-config.ts
View file @
ad4f5ce5
...
@@ -394,8 +394,8 @@ export default async function getBaseWebpackConfig(
...
@@ -394,8 +394,8 @@ export default async function getBaseWebpackConfig(
const
hasAppDir
=
!!
appDir
const
hasAppDir
=
!!
appDir
const
disableOptimizedLoading
=
true
const
disableOptimizedLoading
=
true
// Combine reactProductionProfiling with
profiler
flag for React profiling builds
// Combine reactProductionProfiling with
insights
flag for React profiling builds
const
enableReactProfiling
=
reactProductionProfiling
||
config
.
profiler
const
enableReactProfiling
=
reactProductionProfiling
||
config
.
insights
const
bundledReactChannel
=
needsExperimentalReact
(
config
)
const
bundledReactChannel
=
needsExperimentalReact
(
config
)
?
'-experimental'
?
'-experimental'
:
''
:
''
...
...
packages/next/src/cli/next-build.ts
View file @
ad4f5ce5
...
@@ -21,7 +21,7 @@ export type NextBuildOptions = {
...
@@ -21,7 +21,7 @@ export type NextBuildOptions = {
debug
?:
boolean
debug
?:
boolean
debugPrerender
?:
boolean
debugPrerender
?:
boolean
profile
?:
boolean
profile
?:
boolean
profiler
?:
boolean
insights
?:
boolean
mangling
:
boolean
mangling
:
boolean
turbo
?:
boolean
turbo
?:
boolean
turbopack
?:
boolean
turbopack
?:
boolean
...
@@ -45,7 +45,7 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
...
@@ -45,7 +45,7 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
debugPrerender
,
debugPrerender
,
experimentalDebugMemoryUsage
,
experimentalDebugMemoryUsage
,
profile
,
profile
,
profiler
,
insights
,
mangling
,
mangling
,
experimentalAppOnly
,
experimentalAppOnly
,
experimentalBuildMode
,
experimentalBuildMode
,
...
@@ -86,9 +86,9 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
...
@@ -86,9 +86,9 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
)
)
}
}
if
(
profiler
)
{
if
(
insights
)
{
warn
(
warn
(
`
Profiler
build is enabled.
${
italic
(
`
Insights
build is enabled.
${
italic
(
'Note: Source maps are enabled and minification is disabled. This build is not suitable for production.'
'Note: Source maps are enabled and minification is disabled. This build is not suitable for production.'
)}
`
)}
`
)
)
...
@@ -139,7 +139,7 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
...
@@ -139,7 +139,7 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
traceUploadUrl
,
traceUploadUrl
,
resolvedAppPaths
,
resolvedAppPaths
,
resolvedPagePaths
,
resolvedPagePaths
,
profiler
insights
)
)
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
if
(
experimentalDebugMemoryUsage
)
{
if
(
experimentalDebugMemoryUsage
)
{
...
...
packages/next/src/client/app-bootstrap.ts
View file @
ad4f5ce5
...
@@ -15,11 +15,11 @@ window.next = {
...
@@ -15,11 +15,11 @@ window.next = {
appDir
:
true
,
appDir
:
true
,
}
}
// Log
profiler
build info at startup
// Log
insights
build info at startup
if
(
process
.
env
.
__NEXT_
PROFILER
_BUILD
)
{
if
(
process
.
env
.
__NEXT_
INSIGHTS
_BUILD
)
{
console
.
log
(
''
)
console
.
log
(
''
)
console
.
log
(
console
.
log
(
'%c[Next.js
Profiler
Build]'
,
'%c[Next.js
Insights
Build]'
,
'background: #0070f3; color: white; padding: 2px 6px; border-radius: 3px;'
,
'background: #0070f3; color: white; padding: 2px 6px; border-radius: 3px;'
,
'
\
n• Source maps: enabled'
,
'
\
n• Source maps: enabled'
,
'
\
n• Minification: disabled'
,
'
\
n• Minification: disabled'
,
...
...
packages/next/src/client/index.tsx
View file @
ad4f5ce5
...
@@ -50,11 +50,11 @@ import { isNextRouterError } from './components/is-next-router-error'
...
@@ -50,11 +50,11 @@ import { isNextRouterError } from './components/is-next-router-error'
/// <reference types="react-dom/experimental" />
/// <reference types="react-dom/experimental" />
// Log
profiler
build info at startup
// Log
insights
build info at startup
if
(
process
.
env
.
__NEXT_
PROFILER
_BUILD
)
{
if
(
process
.
env
.
__NEXT_
INSIGHTS
_BUILD
)
{
console
.
log
(
''
)
console
.
log
(
''
)
console
.
log
(
console
.
log
(
'%c[Next.js
Profiler
Build]'
,
'%c[Next.js
Insights
Build]'
,
'background: #0070f3; color: white; padding: 2px 6px; border-radius: 3px;'
,
'background: #0070f3; color: white; padding: 2px 6px; border-radius: 3px;'
,
'
\
n• Source maps: enabled'
,
'
\
n• Source maps: enabled'
,
'
\
n• Minification: disabled'
,
'
\
n• Minification: disabled'
,
...
...
packages/next/src/client/waterfall-detector.ts
View file @
ad4f5ce5
This diff is collapsed.
Click to expand it.
packages/next/src/lib/require-instrumentation-client.ts
View file @
ad4f5ce5
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
// Initialize waterfall detector FIRST (before any other code runs)
// Initialize waterfall detector FIRST (before any other code runs)
// This must happen before the instrumentation client is loaded to patch fetch early
// This must happen before the instrumentation client is loaded to patch fetch early
let
disableWaterfallDetector
:
(()
=>
void
)
|
null
=
null
let
disableWaterfallDetector
:
(()
=>
void
)
|
null
=
null
if
(
process
.
env
.
__NEXT_
PROFILER
_BUILD
)
{
if
(
process
.
env
.
__NEXT_
INSIGHTS
_BUILD
)
{
const
waterfallDetector
=
const
waterfallDetector
=
require
(
'../client/waterfall-detector'
)
as
typeof
import
(
'../client/waterfall-detector'
)
require
(
'../client/waterfall-detector'
)
as
typeof
import
(
'../client/waterfall-detector'
)
waterfallDetector
.
initWaterfallDetector
()
waterfallDetector
.
initWaterfallDetector
()
...
...
packages/next/src/server/config-shared.ts
View file @
ad4f5ce5
...
@@ -1141,11 +1141,11 @@ export interface NextConfig {
...
@@ -1141,11 +1141,11 @@ export interface NextConfig {
reactProductionProfiling
?:
boolean
reactProductionProfiling
?:
boolean
/**
/**
* Enable
profiler
build with source maps and no minification.
* Enable
insights
build with source maps and no minification.
* This is set automatically when using `next build --
profiler
`.
* This is set automatically when using `next build --
insights
`.
* @internal
* @internal
*/
*/
profiler
?:
boolean
insights
?:
boolean
/**
/**
* The Next.js runtime is Strict Mode-compliant.
* The Next.js runtime is Strict Mode-compliant.
...
@@ -1429,7 +1429,7 @@ export const defaultConfig = Object.freeze({
...
@@ -1429,7 +1429,7 @@ export const defaultConfig = Object.freeze({
productionBrowserSourceMaps
:
false
,
productionBrowserSourceMaps
:
false
,
excludeDefaultMomentLocales
:
true
,
excludeDefaultMomentLocales
:
true
,
reactProductionProfiling
:
false
,
reactProductionProfiling
:
false
,
profiler
:
false
,
insights
:
false
,
reactStrictMode
:
null
,
reactStrictMode
:
null
,
reactMaxHeadersLength
:
6000
,
reactMaxHeadersLength
:
6000
,
httpAgentOptions
:
{
httpAgentOptions
:
{
...
@@ -1632,7 +1632,7 @@ export interface NextConfigRuntime {
...
@@ -1632,7 +1632,7 @@ export interface NextConfigRuntime {
skipProxyUrlNormalize
:
NextConfigComplete
[
'skipProxyUrlNormalize'
]
skipProxyUrlNormalize
:
NextConfigComplete
[
'skipProxyUrlNormalize'
]
pageExtensions
:
NextConfigComplete
[
'pageExtensions'
]
pageExtensions
:
NextConfigComplete
[
'pageExtensions'
]
useFileSystemPublicRoutes
:
NextConfigComplete
[
'useFileSystemPublicRoutes'
]
useFileSystemPublicRoutes
:
NextConfigComplete
[
'useFileSystemPublicRoutes'
]
profiler
?:
NextConfigComplete
[
'profiler
'
]
insights
?:
NextConfigComplete
[
'insights
'
]
experimental
:
Pick
<
experimental
:
Pick
<
NextConfigComplete
[
'experimental'
],
NextConfigComplete
[
'experimental'
],
...
@@ -1762,7 +1762,7 @@ export function getNextConfigRuntime(
...
@@ -1762,7 +1762,7 @@ export function getNextConfigRuntime(
skipProxyUrlNormalize
:
config
.
skipProxyUrlNormalize
,
skipProxyUrlNormalize
:
config
.
skipProxyUrlNormalize
,
pageExtensions
:
config
.
pageExtensions
,
pageExtensions
:
config
.
pageExtensions
,
useFileSystemPublicRoutes
:
config
.
useFileSystemPublicRoutes
,
useFileSystemPublicRoutes
:
config
.
useFileSystemPublicRoutes
,
profiler
:
config
.
profiler
,
insights
:
config
.
insights
,
experimental
,
experimental
,
}
}
...
...
packages/next/src/server/config.ts
View file @
ad4f5ce5
...
@@ -1415,7 +1415,7 @@ function getCacheKey(
...
@@ -1415,7 +1415,7 @@ function getCacheKey(
customConfig
?:
object
|
null
,
customConfig
?:
object
|
null
,
reactProductionProfiling
?:
boolean
,
reactProductionProfiling
?:
boolean
,
debugPrerender
?:
boolean
,
debugPrerender
?:
boolean
,
profiler
?:
boolean
,
insights
?:
boolean
,
pid
?:
number
pid
?:
number
):
string
{
):
string
{
// The next.config.js is unique per project, so we can use the dir as the major key
// The next.config.js is unique per project, so we can use the dir as the major key
...
@@ -1426,7 +1426,7 @@ function getCacheKey(
...
@@ -1426,7 +1426,7 @@ function getCacheKey(
hasCustomConfig
:
Boolean
(
customConfig
),
hasCustomConfig
:
Boolean
(
customConfig
),
reactProductionProfiling
:
Boolean
(
reactProductionProfiling
),
reactProductionProfiling
:
Boolean
(
reactProductionProfiling
),
debugPrerender
:
Boolean
(
debugPrerender
),
debugPrerender
:
Boolean
(
debugPrerender
),
profiler
:
Boolean
(
profiler
),
insights
:
Boolean
(
insights
),
pid
:
pid
||
0
,
pid
:
pid
||
0
,
})
})
...
@@ -1442,7 +1442,7 @@ type LoadConfigOptions = {
...
@@ -1442,7 +1442,7 @@ type LoadConfigOptions = {
)
=>
void
)
=>
void
reactProductionProfiling
?:
boolean
reactProductionProfiling
?:
boolean
debugPrerender
?:
boolean
debugPrerender
?:
boolean
profiler
?:
boolean
insights
?:
boolean
}
}
export
default
async
function
loadConfig
(
export
default
async
function
loadConfig
(
...
@@ -1471,7 +1471,7 @@ export default async function loadConfig(
...
@@ -1471,7 +1471,7 @@ export default async function loadConfig(
reportExperimentalFeatures
,
reportExperimentalFeatures
,
reactProductionProfiling
,
reactProductionProfiling
,
debugPrerender
,
debugPrerender
,
profiler
,
insights
,
}:
LoadConfigOptions
=
{}
}:
LoadConfigOptions
=
{}
):
Promise
<
NextConfigComplete
>
{
):
Promise
<
NextConfigComplete
>
{
// Generate cache key based on parameters that affect config output
// Generate cache key based on parameters that affect config output
...
@@ -1482,7 +1482,7 @@ export default async function loadConfig(
...
@@ -1482,7 +1482,7 @@ export default async function loadConfig(
customConfig
,
customConfig
,
reactProductionProfiling
,
reactProductionProfiling
,
debugPrerender
,
debugPrerender
,
profiler
,
insights
,
process
.
pid
process
.
pid
)
)
...
@@ -1723,7 +1723,7 @@ export default async function loadConfig(
...
@@ -1723,7 +1723,7 @@ export default async function loadConfig(
isDefaultConfig
:
false
,
isDefaultConfig
:
false
,
configuredExperimentalFeatures
,
configuredExperimentalFeatures
,
debugPrerender
,
debugPrerender
,
profiler
,
insights
,
phase
,
phase
,
})
})
...
@@ -1782,7 +1782,7 @@ export default async function loadConfig(
...
@@ -1782,7 +1782,7 @@ export default async function loadConfig(
isDefaultConfig
:
true
,
isDefaultConfig
:
true
,
configuredExperimentalFeatures
,
configuredExperimentalFeatures
,
debugPrerender
,
debugPrerender
,
profiler
,
insights
,
phase
,
phase
,
})
})
...
@@ -1825,14 +1825,14 @@ function enforceExperimentalFeatures(
...
@@ -1825,14 +1825,14 @@ function enforceExperimentalFeatures(
isDefaultConfig
:
boolean
isDefaultConfig
:
boolean
configuredExperimentalFeatures
:
ConfiguredExperimentalFeature
[]
|
undefined
configuredExperimentalFeatures
:
ConfiguredExperimentalFeature
[]
|
undefined
debugPrerender
:
boolean
|
undefined
debugPrerender
:
boolean
|
undefined
profiler
:
boolean
|
undefined
insights
:
boolean
|
undefined
phase
:
PHASE_TYPE
phase
:
PHASE_TYPE
}
}
)
{
)
{
const
{
const
{
configuredExperimentalFeatures
,
configuredExperimentalFeatures
,
debugPrerender
,
debugPrerender
,
profiler
,
insights
,
isDefaultConfig
,
isDefaultConfig
,
phase
,
phase
,
}
=
options
}
=
options
...
@@ -1868,9 +1868,9 @@ function enforceExperimentalFeatures(
...
@@ -1868,9 +1868,9 @@ function enforceExperimentalFeatures(
)
)
}
}
//
Profiler
build: enable source maps (client + server) and disable minification
//
Insights
build: enable source maps (client + server) and disable minification
if
(
if
(
profiler
&&
insights
&&
(
phase
===
PHASE_PRODUCTION_BUILD
||
phase
===
PHASE_EXPORT
)
(
phase
===
PHASE_PRODUCTION_BUILD
||
phase
===
PHASE_EXPORT
)
)
{
)
{
// Enable client-side source maps
// Enable client-side source maps
...
@@ -1901,8 +1901,8 @@ function enforceExperimentalFeatures(
...
@@ -1901,8 +1901,8 @@ function enforceExperimentalFeatures(
configuredExperimentalFeatures
configuredExperimentalFeatures
)
)
// Mark this as a
profiler
build in config for runtime detection
// Mark this as a
insights
build in config for runtime detection
config
.
profiler
=
true
config
.
insights
=
true
}
}
// TODO: Remove this once we've made Cache Components the default.
// TODO: Remove this once we've made Cache Components the default.
...
...
packages/next/src/server/lib/app-info-log.ts
View file @
ad4f5ce5
...
@@ -16,6 +16,7 @@ export function logStartInfo({
...
@@ -16,6 +16,7 @@ export function logStartInfo({
experimentalFeatures
,
experimentalFeatures
,
logBundler
,
logBundler
,
cacheComponents
,
cacheComponents
,
insights
,
}:
{
}:
{
networkUrl
:
string
|
null
networkUrl
:
string
|
null
appUrl
:
string
|
null
appUrl
:
string
|
null
...
@@ -23,6 +24,7 @@ export function logStartInfo({
...
@@ -23,6 +24,7 @@ export function logStartInfo({
experimentalFeatures
?:
ConfiguredExperimentalFeature
[]
experimentalFeatures
?:
ConfiguredExperimentalFeature
[]
logBundler
:
boolean
logBundler
:
boolean
cacheComponents
?:
boolean
cacheComponents
?:
boolean
insights
?:
boolean
})
{
})
{
let
versionSuffix
=
''
let
versionSuffix
=
''
const
parts
=
[]
const
parts
=
[]
...
@@ -41,6 +43,10 @@ export function logStartInfo({
...
@@ -41,6 +43,10 @@ export function logStartInfo({
parts
.
push
(
'Cache Components'
)
parts
.
push
(
'Cache Components'
)
}
}
if
(
insights
)
{
parts
.
push
(
'Insights'
)
}
if
(
parts
.
length
>
0
)
{
if
(
parts
.
length
>
0
)
{
versionSuffix
=
` (
${
parts
.
join
(
', '
)}
)`
versionSuffix
=
` (
${
parts
.
join
(
', '
)}
)`
}
}
...
@@ -114,9 +120,11 @@ export async function getStartServerInfo({
...
@@ -114,9 +120,11 @@ export async function getStartServerInfo({
envInfo
?:
string
[]
envInfo
?:
string
[]
experimentalFeatures
?:
ConfiguredExperimentalFeature
[]
experimentalFeatures
?:
ConfiguredExperimentalFeature
[]
cacheComponents
?:
boolean
cacheComponents
?:
boolean
insights
?:
boolean
}
>
{
}
>
{
let
experimentalFeatures
:
ConfiguredExperimentalFeature
[]
=
[]
let
experimentalFeatures
:
ConfiguredExperimentalFeature
[]
=
[]
let
cacheComponents
=
false
let
cacheComponents
=
false
let
insights
=
false
const
config
=
await
loadConfig
(
const
config
=
await
loadConfig
(
dev
?
PHASE_DEVELOPMENT_SERVER
:
PHASE_PRODUCTION_BUILD
,
dev
?
PHASE_DEVELOPMENT_SERVER
:
PHASE_PRODUCTION_BUILD
,
dir
,
dir
,
...
@@ -132,6 +140,7 @@ export async function getStartServerInfo({
...
@@ -132,6 +140,7 @@ export async function getStartServerInfo({
)
)
cacheComponents
=
!!
config
.
cacheComponents
cacheComponents
=
!!
config
.
cacheComponents
insights
=
!!
config
.
insights
// we need to reset env if we are going to create
// we need to reset env if we are going to create
// the worker process with the esm loader so that the
// the worker process with the esm loader so that the
...
@@ -146,5 +155,6 @@ export async function getStartServerInfo({
...
@@ -146,5 +155,6 @@ export async function getStartServerInfo({
envInfo
,
envInfo
,
experimentalFeatures
,
experimentalFeatures
,
cacheComponents
,
cacheComponents
,
insights
,
}
}
}
}
packages/next/src/server/lib/start-server.ts
View file @
ad4f5ce5
...
@@ -355,15 +355,22 @@ export async function startServer(
...
@@ -355,15 +355,22 @@ export async function startServer(
}
}
// Only load env and config in dev to for logging purposes
// Only load env and config in dev to for logging purposes
// For production, we still need to check for insights mode
let
envInfo
:
string
[]
|
undefined
let
envInfo
:
string
[]
|
undefined
let
experimentalFeatures
:
ConfiguredExperimentalFeature
[]
|
undefined
let
experimentalFeatures
:
ConfiguredExperimentalFeature
[]
|
undefined
let
cacheComponents
:
boolean
|
undefined
let
cacheComponents
:
boolean
|
undefined
let
insights
:
boolean
|
undefined
try
{
try
{
if
(
isDev
)
{
if
(
isDev
)
{
const
startServerInfo
=
await
getStartServerInfo
({
dir
,
dev
:
isDev
})
const
startServerInfo
=
await
getStartServerInfo
({
dir
,
dev
:
isDev
})
envInfo
=
startServerInfo
.
envInfo
envInfo
=
startServerInfo
.
envInfo
cacheComponents
=
startServerInfo
.
cacheComponents
cacheComponents
=
startServerInfo
.
cacheComponents
experimentalFeatures
=
startServerInfo
.
experimentalFeatures
experimentalFeatures
=
startServerInfo
.
experimentalFeatures
insights
=
startServerInfo
.
insights
}
else
{
// For production, check if this is an insights build
const
startServerInfo
=
await
getStartServerInfo
({
dir
,
dev
:
false
})
insights
=
startServerInfo
.
insights
}
}
logStartInfo
({
logStartInfo
({
networkUrl
,
networkUrl
,
...
@@ -371,6 +378,7 @@ export async function startServer(
...
@@ -371,6 +378,7 @@ export async function startServer(
envInfo
,
envInfo
,
experimentalFeatures
,
experimentalFeatures
,
cacheComponents
,
cacheComponents
,
insights
,
logBundler
:
isDev
,
logBundler
:
isDev
,
})
})
...
...
packages/next/src/server/next-server.ts
View file @
ad4f5ce5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment