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
6bc2550c
Commit
6bc2550c
authored
Sep 18, 2025
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Development: Don't block on TypeScript validation
parent
e5afc390
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
60 deletions
+67
-60
setup-dev-bundler.ts
...ges/next/src/server/lib/router-utils/setup-dev-bundler.ts
+67
-60
No files found.
packages/next/src/server/lib/router-utils/setup-dev-bundler.ts
View file @
6bc2550c
...
...
@@ -344,7 +344,7 @@ async function startWatcher(
},
})
const
fileWatchTimes
=
new
Map
()
let
enabledTypeScript
=
await
verifyTypeScript
(
opts
)
let
enabledTypeScript
:
Promise
<
boolean
>
=
verifyTypeScript
(
opts
)
let
previousClientRouterFilters
:
any
let
previousConflictingPagePaths
:
Set
<
string
>
=
new
Set
()
...
...
@@ -411,7 +411,7 @@ async function startWatcher(
if
(
tsconfigPaths
.
includes
(
fileName
))
{
if
(
fileName
.
endsWith
(
'tsconfig.json'
))
{
enabledTypeScript
=
true
enabledTypeScript
=
Promise
.
resolve
(
true
)
}
if
(
watchTimeChange
)
{
tsconfigChange
=
true
...
...
@@ -487,7 +487,7 @@ async function startWatcher(
}
if
(
fileName
.
endsWith
(
'.ts'
)
||
fileName
.
endsWith
(
'.tsx'
))
{
enabledTypeScript
=
true
enabledTypeScript
=
Promise
.
resolve
(
true
)
}
if
(
!
(
isAppPath
||
isPagePath
))
{
...
...
@@ -1054,69 +1054,76 @@ async function startWatcher(
}
prevSortedRoutes
=
sortedRoutes
if
(
enabledTypeScript
)
{
// Using === false to make the check clearer.
if
(
typescriptStatusFromLastAggregation
===
false
)
{
// we tolerate the error here as this is best effort
// and the manual install command will be shown
await
verifyTypeScript
(
opts
)
.
then
(()
=>
{
tsconfigChange
=
true
enabledTypeScript
.
then
(
async
(
enabled
)
=>
{
if
(
!
enabled
)
{
return
}
// Using === false to make the check clearer.
if
((
await
typescriptStatusFromLastAggregation
)
===
false
)
{
// we tolerate the error here as this is best effort
// and the manual install command will be shown
await
verifyTypeScript
(
opts
)
.
then
(()
=>
{
tsconfigChange
=
true
})
.
catch
(()
=>
{})
}
if
(
writeEnvDefinitions
&&
nextConfig
.
experimental
?.
typedEnv
)
{
// TODO: The call to propagateServerField 'loadEnvConfig' causes the env to be loaded twice on env file changes.
const
loadEnvConfig
=
(
require
(
'@next/env'
)
as
typeof
import
(
'@next/env'
)
).
loadEnvConfig
const
{
loadedEnvFiles
}
=
loadEnvConfig
(
dir
,
process
.
env
.
NODE_ENV
===
'development'
,
// Silent as it's the second time `loadEnvConfig` is called in this pass.
undefined
,
true
)
const
createEnvDefinitions
=
(
require
(
'../experimental/create-env-definitions'
)
as
typeof
import
(
'../experimental/create-env-definitions'
)
).
createEnvDefinitions
await
createEnvDefinitions
({
distDir
,
loadedEnvFiles
:
[
...
loadedEnvFiles
,
{
path
:
nextConfig
.
configFileName
,
env
:
nextConfig
.
env
,
contents
:
''
,
},
],
})
.
catch
(()
=>
{})
}
}
if
(
writeEnvDefinitions
&&
nextConfig
.
experimental
?.
typedEnv
)
{
// TODO: The call to propagateServerField 'loadEnvConfig' causes the env to be loaded twice on env file changes.
const
loadEnvConfig
=
(
require
(
'@next/env'
)
as
typeof
import
(
'@next/env'
)
).
loadEnvConfig
const
{
loadedEnvFiles
}
=
loadEnvConfig
(
const
routeTypesManifest
=
await
createRouteTypesManifest
({
dir
,
process
.
env
.
NODE_ENV
===
'development'
,
// Silent as it's the second time `loadEnvConfig` is called in this pass.
undefined
,
true
)
const
createEnvDefinitions
=
(
require
(
'../experimental/create-env-definitions'
)
as
typeof
import
(
'../experimental/create-env-definitions'
)
).
createEnvDefinitions
await
createEnvDefinitions
({
distDir
,
loadedEnvFiles
:
[
...
loadedEnvFiles
,
{
path
:
nextConfig
.
configFileName
,
env
:
nextConfig
.
env
,
contents
:
''
,
},
],
pageRoutes
,
appRoutes
,
layoutRoutes
,
slots
,
redirects
:
opts
.
nextConfig
.
redirects
,
rewrites
:
opts
.
nextConfig
.
rewrites
,
// Ensure relative paths in validator.ts are computed from validatorFilePath,
// matching behavior of build and CLI typegen.
validatorFilePath
,
appRouteHandlers
,
pageApiRoutes
,
})
}
const
routeTypesManifest
=
await
createRouteTypesManifest
({
dir
,
pageRoutes
,
appRoutes
,
layoutRoutes
,
slots
,
redirects
:
opts
.
nextConfig
.
redirects
,
rewrites
:
opts
.
nextConfig
.
rewrites
,
// Ensure relative paths in validator.ts are computed from validatorFilePath,
// matching behavior of build and CLI typegen.
validatorFilePath
,
appRouteHandlers
,
pageApiRoutes
,
await
writeRouteTypesManifest
(
routeTypesManifest
,
routeTypesFilePath
,
opts
.
nextConfig
)
await
writeValidatorFile
(
routeTypesManifest
,
validatorFilePath
)
})
.
catch
((
err
)
=>
{
Log
.
warn
(
'Failed to create TypeScript setup'
,
err
)
})
await
writeRouteTypesManifest
(
routeTypesManifest
,
routeTypesFilePath
,
opts
.
nextConfig
)
await
writeValidatorFile
(
routeTypesManifest
,
validatorFilePath
)
}
if
(
!
resolved
)
{
resolve
()
...
...
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