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
322adb98
Unverified
Commit
322adb98
authored
Jun 22, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Jun 22, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[devtools] Fix Turbopack indicator (#80753)
parent
992d507c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
63 deletions
+74
-63
next-devtools.webpack-config.js
packages/next/next-devtools.webpack-config.js
+0
-19
index.test.ts
test/development/client-dev-overlay/index.test.ts
+74
-44
No files found.
packages/next/next-devtools.webpack-config.js
View file @
322adb98
...
@@ -18,7 +18,6 @@ function shouldIgnorePath(modulePath) {
...
@@ -18,7 +18,6 @@ function shouldIgnorePath(modulePath) {
*/
*/
module
.
exports
=
({
dev
,
...
rest
})
=>
{
module
.
exports
=
({
dev
,
...
rest
})
=>
{
const
experimental
=
false
const
experimental
=
false
const
turbo
=
false
const
bundledReactChannel
=
experimental
?
'-experimental'
:
''
const
bundledReactChannel
=
experimental
?
'-experimental'
:
''
...
@@ -52,24 +51,6 @@ module.exports = ({ dev, ...rest }) => {
...
@@ -52,24 +51,6 @@ module.exports = ({ dev, ...rest }) => {
plugins
:
[
plugins
:
[
// TODO: React Compiler
// TODO: React Compiler
new
DevToolsIgnoreListPlugin
({
shouldIgnorePath
}),
new
DevToolsIgnoreListPlugin
({
shouldIgnorePath
}),
new
webpack
.
DefinePlugin
({
// TODO: Hardcode it and ensure module resolution resolves to .node entrypoint in Node.js
// 'typeof window': JSON.stringify('object'),
'process.env.NEXT_MINIMAL'
:
JSON
.
stringify
(
'true'
),
'this.serverOptions.experimentalTestProxy'
:
JSON
.
stringify
(
false
),
'this.minimalMode'
:
JSON
.
stringify
(
true
),
'this.renderOpts.dev'
:
JSON
.
stringify
(
dev
),
'renderOpts.dev'
:
JSON
.
stringify
(
dev
),
'process.env.NODE_ENV'
:
JSON
.
stringify
(
dev
?
'development'
:
'production'
),
'process.env.__NEXT_EXPERIMENTAL_REACT'
:
JSON
.
stringify
(
experimental
?
true
:
false
),
'process.env.NEXT_RUNTIME'
:
JSON
.
stringify
(
'nodejs'
),
'process.turbopack'
:
JSON
.
stringify
(
turbo
),
'process.env.TURBOPACK'
:
JSON
.
stringify
(
turbo
),
}),
].
filter
(
Boolean
),
].
filter
(
Boolean
),
stats
:
{
stats
:
{
optimizationBailout
:
true
,
optimizationBailout
:
true
,
...
...
test/development/client-dev-overlay/index.test.ts
View file @
322adb98
import
{
createNext
,
FileRef
}
from
'e2e-utils'
import
{
FileRef
}
from
'e2e-utils'
import
webdriver
,
{
Playwright
}
from
'next-webdriver'
import
{
Playwright
}
from
'next-webdriver'
import
{
NextInstance
}
from
'e2e-utils'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
join
}
from
'path'
import
{
join
}
from
'path'
import
{
retry
}
from
'next-test-utils'
import
{
openDevToolsIndicatorPopover
,
retry
}
from
'next-test-utils'
describe
(
'client-dev-overlay'
,
()
=>
{
describe
(
'client-dev-overlay'
,
()
=>
{
let
next
:
NextInstance
const
{
next
,
isTurbopack
}
=
nextTestSetup
({
let
browser
:
Playwright
files
:
{
pages
:
new
FileRef
(
join
(
__dirname
,
'app/pages'
)),
beforeAll
(
async
()
=>
{
},
next
=
await
createNext
({
env
:
{
files
:
{
// Disable the cooldown period for the dev indicator so that hiding the indicator in a test doesn't
pages
:
new
FileRef
(
join
(
__dirname
,
'app/pages'
)),
// impact subsequent tests.
},
__NEXT_DEV_INDICATOR_COOLDOWN_MS
:
'0'
,
env
:
{
},
// Disable the cooldown period for the dev indicator so that hiding the indicator in a test doesn't
// impact subsequent tests.
__NEXT_DEV_INDICATOR_COOLDOWN_MS
:
'0'
,
},
})
})
beforeEach
(
async
()
=>
{
browser
=
await
webdriver
(
next
.
url
,
''
)
})
})
afterAll
(()
=>
next
.
destroy
())
// The `Playwright.hasElementByCssSelector` cannot be used for elements inside a shadow DOM.
// The `Playwright.hasElementByCssSelector` cannot be used for elements inside a shadow DOM.
function
elementExistsInNextJSPortalShadowDOM
(
selector
:
string
)
{
function
elementExistsInNextJSPortalShadowDOM
(
browser
:
Playwright
,
selector
:
string
)
{
return
browser
.
eval
(
return
browser
.
eval
(
`!!document.querySelector('nextjs-portal').shadowRoot.querySelector('
${
selector
}
')`
`!!document.querySelector('nextjs-portal').shadowRoot.querySelector('
${
selector
}
')`
)
as
any
)
as
any
...
@@ -40,45 +34,51 @@ describe('client-dev-overlay', () => {
...
@@ -40,45 +34,51 @@ describe('client-dev-overlay', () => {
preferencesButton
:
'[data-preferences]'
,
preferencesButton
:
'[data-preferences]'
,
hideButton
:
'[data-hide-dev-tools]'
,
hideButton
:
'[data-hide-dev-tools]'
,
}
}
function
getToast
()
{
function
getToast
(
browser
:
Playwright
)
{
return
browser
.
elementByCss
(
selectors
.
toast
)
return
browser
.
elementByCss
(
selectors
.
toast
)
}
}
function
getPopover
()
{
function
getPopover
(
browser
:
Playwright
)
{
return
browser
.
elementByCss
(
selectors
.
popover
)
return
browser
.
elementByCss
(
selectors
.
popover
)
}
}
function
getMinimizeButton
()
{
function
getMinimizeButton
(
browser
:
Playwright
)
{
return
browser
.
elementByCss
(
selectors
.
minimizeButton
)
return
browser
.
elementByCss
(
selectors
.
minimizeButton
)
}
}
function
getHideButton
()
{
function
getHideButton
(
browser
:
Playwright
)
{
return
browser
.
elementByCss
(
selectors
.
hideButton
)
return
browser
.
elementByCss
(
selectors
.
hideButton
)
}
}
function
getPreferencesButton
()
{
function
getPreferencesButton
(
browser
:
Playwright
)
{
return
browser
.
elementByCss
(
selectors
.
preferencesButton
)
return
browser
.
elementByCss
(
selectors
.
preferencesButton
)
}
}
it
(
'should be able to fullscreen the minimized overlay'
,
async
()
=>
{
it
(
'should be able to fullscreen the minimized overlay'
,
async
()
=>
{
await
getMinimizeButton
().
click
()
const
browser
=
await
next
.
browser
(
'/'
)
await
getToast
().
click
()
await
getMinimizeButton
(
browser
).
click
()
await
getToast
(
browser
).
click
()
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
expect
(
expect
(
await
elementExistsInNextJSPortalShadowDOM
(
selectors
.
fullScreenDialog
)
await
elementExistsInNextJSPortalShadowDOM
(
browser
,
selectors
.
fullScreenDialog
)
).
toBe
(
true
)
).
toBe
(
true
)
})
})
})
})
it
(
'should be able to minimize the fullscreen overlay'
,
async
()
=>
{
it
(
'should be able to minimize the fullscreen overlay'
,
async
()
=>
{
await
getMinimizeButton
().
click
()
const
browser
=
await
next
.
browser
(
'/'
)
expect
(
await
elementExistsInNextJSPortalShadowDOM
(
selectors
.
toast
)).
toBe
(
await
getMinimizeButton
(
browser
).
click
()
true
expect
(
)
await
elementExistsInNextJSPortalShadowDOM
(
browser
,
selectors
.
toast
)
).
toBe
(
true
)
})
})
it
(
'should keep the error indicator visible when there are errors'
,
async
()
=>
{
it
(
'should keep the error indicator visible when there are errors'
,
async
()
=>
{
await
getMinimizeButton
().
click
()
const
browser
=
await
next
.
browser
(
'/'
)
await
getPopover
().
click
()
await
getMinimizeButton
(
browser
).
click
()
await
getPreferencesButton
().
click
()
await
getPopover
(
browser
).
click
()
await
getHideButton
().
click
()
await
getPreferencesButton
(
browser
).
click
()
await
getHideButton
(
browser
).
click
()
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
const
display
=
await
browser
.
eval
(
const
display
=
await
browser
.
eval
(
...
@@ -89,16 +89,17 @@ describe('client-dev-overlay', () => {
...
@@ -89,16 +89,17 @@ describe('client-dev-overlay', () => {
})
})
it
(
'should be possible to hide the minimized overlay when there are no errors'
,
async
()
=>
{
it
(
'should be possible to hide the minimized overlay when there are no errors'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/'
)
const
originalContent
=
await
next
.
readFile
(
'pages/index.js'
)
const
originalContent
=
await
next
.
readFile
(
'pages/index.js'
)
try
{
try
{
await
next
.
patchFile
(
'pages/index.js'
,
(
content
)
=>
{
await
next
.
patchFile
(
'pages/index.js'
,
(
content
)
=>
{
return
content
.
replace
(
`throw Error('example runtime error')`
,
''
)
return
content
.
replace
(
`throw Error('example runtime error')`
,
''
)
})
})
await
getMinimizeButton
().
click
()
await
getMinimizeButton
(
browser
).
click
()
await
getPopover
().
click
()
await
getPopover
(
browser
).
click
()
await
getPreferencesButton
().
click
()
await
getPreferencesButton
(
browser
).
click
()
await
getHideButton
().
click
()
await
getHideButton
(
browser
).
click
()
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
const
display
=
await
browser
.
eval
(
const
display
=
await
browser
.
eval
(
...
@@ -112,10 +113,39 @@ describe('client-dev-overlay', () => {
...
@@ -112,10 +113,39 @@ describe('client-dev-overlay', () => {
})
})
it
(
'should have a role of "dialog" if the page is focused'
,
async
()
=>
{
it
(
'should have a role of "dialog" if the page is focused'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/'
)
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
expect
(
expect
(
await
elementExistsInNextJSPortalShadowDOM
(
'[role="dialog"]'
)
await
elementExistsInNextJSPortalShadowDOM
(
browser
,
'[role="dialog"]'
)
).
toBe
(
true
)
).
toBe
(
true
)
})
})
})
})
it
(
'should nudge to use Turbopack unless Turbopack is disabled'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/'
)
await
openDevToolsIndicatorPopover
(
browser
)
const
devtoolsMenu
=
await
browser
.
elementByCss
(
'#nextjs-dev-tools-menu'
)
if
(
isTurbopack
)
{
expect
(
await
devtoolsMenu
.
innerText
()).
toMatchInlineSnapshot
(
`
"Issues
1
Route
Static
Turbopack
Enabled
Preferences"
`
)
}
else
{
expect
(
await
devtoolsMenu
.
innerText
()).
toMatchInlineSnapshot
(
`
"Issues
1
Route
Static
Try Turbopack
Preferences"
`
)
}
})
})
})
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