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
0d49f22e
Unverified
Commit
0d49f22e
authored
May 15, 2020
by
Joe Haddad
Committed by
GitHub
May 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `react-error-overlay` (#12942)
parent
9c799550
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
37 additions
and
319 deletions
+37
-319
entries.ts
packages/next/build/entries.ts
+0
-6
webpack-config.ts
packages/next/build/webpack-config.ts
+1
-4
base.ts
packages/next/build/webpack/config/blocks/base.ts
+10
-16
index.ts
packages/next/build/webpack/config/index.ts
+0
-3
utils.ts
packages/next/build/webpack/config/utils.ts
+0
-1
next-client-pages-loader.ts
...es/next/build/webpack/loaders/next-client-pages-loader.ts
+2
-11
hot-dev-client.js
packages/next/client/dev/error-overlay/hot-dev-client.js
+5
-117
source-map-support.ts
packages/next/client/dev/error-overlay/source-map-support.ts
+0
-28
index.js
packages/next/client/index.js
+15
-27
config.ts
packages/next/next-server/server/config.ts
+0
-1
package.json
packages/next/package.json
+0
-1
error-debug.tsx
packages/next/server/error-debug.tsx
+0
-74
hot-reloader.ts
packages/next/server/hot-reloader.ts
+0
-1
next-dev-server.ts
packages/next/server/next-dev-server.ts
+1
-5
on-demand-entry-handler.ts
packages/next/server/on-demand-entry-handler.ts
+0
-3
taskfile.js
packages/next/taskfile.js
+1
-14
index.test.js
test/integration/client-navigation/test/index.test.js
+2
-2
yarn.lock
yarn.lock
+0
-5
No files found.
packages/next/build/entries.ts
View file @
0d49f22e
...
@@ -133,12 +133,6 @@ export function createEntrypoints(
...
@@ -133,12 +133,6 @@ export function createEntrypoints(
const
pageLoaderOpts
:
ClientPagesLoaderOptions
=
{
const
pageLoaderOpts
:
ClientPagesLoaderOptions
=
{
page
,
page
,
absolutePagePath
,
absolutePagePath
,
hotRouterUpdates
:
// Hot router updates only apply in development mode
dev
&&
// However, React Refresh has its own hot module runtime, so we can't
// let them collide.
config
.
experimental
.
reactRefresh
!==
true
,
}
}
const
pageLoader
=
`next-client-pages-loader?
${
stringify
(
const
pageLoader
=
`next-client-pages-loader?
${
stringify
(
pageLoaderOpts
pageLoaderOpts
...
...
packages/next/build/webpack-config.ts
View file @
0d49f22e
...
@@ -153,8 +153,7 @@ export default async function getBaseWebpackConfig(
...
@@ -153,8 +153,7 @@ export default async function getBaseWebpackConfig(
}
}
}
}
const
isReactRefreshEnabled
=
config
.
experimental
.
reactRefresh
===
true
const
hasReactRefresh
=
dev
&&
!
isServer
const
hasReactRefresh
=
dev
&&
!
isServer
&&
isReactRefreshEnabled
const
distDir
=
path
.
join
(
dir
,
config
.
distDir
)
const
distDir
=
path
.
join
(
dir
,
config
.
distDir
)
const
defaultLoaders
=
{
const
defaultLoaders
=
{
...
@@ -844,7 +843,6 @@ export default async function getBaseWebpackConfig(
...
@@ -844,7 +843,6 @@ export default async function getBaseWebpackConfig(
'process.env.__NEXT_ROUTER_BASEPATH'
:
JSON
.
stringify
(
'process.env.__NEXT_ROUTER_BASEPATH'
:
JSON
.
stringify
(
config
.
experimental
.
basePath
config
.
experimental
.
basePath
),
),
'process.env.__NEXT_FAST_REFRESH'
:
JSON
.
stringify
(
hasReactRefresh
),
...(
isServer
...(
isServer
?
{
?
{
// Fix bad-actors in the npm ecosystem (e.g. `node-formidable`)
// Fix bad-actors in the npm ecosystem (e.g. `node-formidable`)
...
@@ -1032,7 +1030,6 @@ export default async function getBaseWebpackConfig(
...
@@ -1032,7 +1030,6 @@ export default async function getBaseWebpackConfig(
customAppFile
,
customAppFile
,
isDevelopment
:
dev
,
isDevelopment
:
dev
,
isServer
,
isServer
,
isReactRefreshEnabled
,
assetPrefix
:
config
.
assetPrefix
||
''
,
assetPrefix
:
config
.
assetPrefix
||
''
,
sassOptions
:
config
.
sassOptions
,
sassOptions
:
config
.
sassOptions
,
})
})
...
...
packages/next/build/webpack/config/blocks/base.ts
View file @
0d49f22e
...
@@ -12,23 +12,17 @@ export const base = curry(function base(
...
@@ -12,23 +12,17 @@ export const base = curry(function base(
// https://webpack.js.org/configuration/devtool/#development
// https://webpack.js.org/configuration/devtool/#development
if
(
ctx
.
isDevelopment
)
{
if
(
ctx
.
isDevelopment
)
{
if
(
ctx
.
isReactRefreshEnabled
)
{
if
(
ctx
.
isServer
||
process
.
platform
===
'win32'
)
{
if
(
ctx
.
isServer
||
process
.
platform
===
'win32'
)
{
// Non-eval based source maps are slow to rebuild, so we only enable
// Non-eval based source maps are slow to rebuild, so we only enable
// them for the server and Windows. Unfortunately, eval source maps
// them for the server and Windows. Unfortunately, eval source maps
// are not supported by Node.js, and are slow on Windows.
// are not supported by Node.js, and are slow on Windows.
config
.
devtool
=
'inline-source-map'
config
.
devtool
=
'inline-source-map'
}
else
{
// `eval-source-map` provides full-fidelity source maps for the
// original source, including columns and original variable names.
// This is desirable so the in-browser debugger can correctly pause
// and show scoped variables with their original names.
config
.
devtool
=
'eval-source-map'
}
}
else
{
}
else
{
// `cheap-module-source-map` is the old preferred format that was
// `eval-source-map` provides full-fidelity source maps for the
// required for `react-error-overlay`.
// original source, including columns and original variable names.
config
.
devtool
=
'cheap-module-source-map'
// This is desirable so the in-browser debugger can correctly pause
// and show scoped variables with their original names.
config
.
devtool
=
'eval-source-map'
}
}
}
else
{
}
else
{
config
.
devtool
=
false
config
.
devtool
=
false
...
...
packages/next/build/webpack/config/index.ts
View file @
0d49f22e
...
@@ -10,7 +10,6 @@ export async function build(
...
@@ -10,7 +10,6 @@ export async function build(
customAppFile
,
customAppFile
,
isDevelopment
,
isDevelopment
,
isServer
,
isServer
,
isReactRefreshEnabled
,
assetPrefix
,
assetPrefix
,
sassOptions
,
sassOptions
,
}:
{
}:
{
...
@@ -18,7 +17,6 @@ export async function build(
...
@@ -18,7 +17,6 @@ export async function build(
customAppFile
:
string
|
null
customAppFile
:
string
|
null
isDevelopment
:
boolean
isDevelopment
:
boolean
isServer
:
boolean
isServer
:
boolean
isReactRefreshEnabled
:
boolean
assetPrefix
:
string
assetPrefix
:
string
sassOptions
:
any
sassOptions
:
any
}
}
...
@@ -28,7 +26,6 @@ export async function build(
...
@@ -28,7 +26,6 @@ export async function build(
customAppFile
,
customAppFile
,
isDevelopment
,
isDevelopment
,
isProduction
:
!
isDevelopment
,
isProduction
:
!
isDevelopment
,
isReactRefreshEnabled
,
isServer
,
isServer
,
isClient
:
!
isServer
,
isClient
:
!
isServer
,
assetPrefix
:
assetPrefix
assetPrefix
:
assetPrefix
...
...
packages/next/build/webpack/config/utils.ts
View file @
0d49f22e
...
@@ -6,7 +6,6 @@ export type ConfigurationContext = {
...
@@ -6,7 +6,6 @@ export type ConfigurationContext = {
isDevelopment
:
boolean
isDevelopment
:
boolean
isProduction
:
boolean
isProduction
:
boolean
isReactRefreshEnabled
:
boolean
isServer
:
boolean
isServer
:
boolean
isClient
:
boolean
isClient
:
boolean
...
...
packages/next/build/webpack/loaders/next-client-pages-loader.ts
View file @
0d49f22e
...
@@ -4,11 +4,10 @@ import loaderUtils from 'loader-utils'
...
@@ -4,11 +4,10 @@ import loaderUtils from 'loader-utils'
export
type
ClientPagesLoaderOptions
=
{
export
type
ClientPagesLoaderOptions
=
{
absolutePagePath
:
string
absolutePagePath
:
string
page
:
string
page
:
string
hotRouterUpdates
:
boolean
}
}
const
nextClientPagesLoader
:
loader
.
Loader
=
function
()
{
const
nextClientPagesLoader
:
loader
.
Loader
=
function
()
{
const
{
absolutePagePath
,
page
,
hotRouterUpdates
}
=
loaderUtils
.
getOptions
(
const
{
absolutePagePath
,
page
}
=
loaderUtils
.
getOptions
(
this
this
)
as
ClientPagesLoaderOptions
)
as
ClientPagesLoaderOptions
const
stringifiedAbsolutePagePath
=
JSON
.
stringify
(
absolutePagePath
)
const
stringifiedAbsolutePagePath
=
JSON
.
stringify
(
absolutePagePath
)
...
@@ -18,15 +17,7 @@ const nextClientPagesLoader: loader.Loader = function() {
...
@@ -18,15 +17,7 @@ const nextClientPagesLoader: loader.Loader = function() {
(window.__NEXT_P = window.__NEXT_P || []).push([
(window.__NEXT_P = window.__NEXT_P || []).push([
${
stringifiedPage
}
,
${
stringifiedPage
}
,
function () {
function () {
var mod = require(
${
stringifiedAbsolutePagePath
}
);
return require(
${
stringifiedAbsolutePagePath
}
);
if (
${
!!
hotRouterUpdates
}
&& module.hot) {
module.hot.accept(
${
stringifiedAbsolutePagePath
}
, function () {
if (!next.router.components[
${
stringifiedPage
}
]) return;
var updatedPage = require(
${
stringifiedAbsolutePagePath
}
);
next.router.update(
${
stringifiedPage
}
, updatedPage);
});
}
return mod;
}
}
]);
]);
`
`
...
...
packages/next/client/dev/error-overlay/hot-dev-client.js
View file @
0d49f22e
...
@@ -27,12 +27,9 @@
...
@@ -27,12 +27,9 @@
// https://github.com/facebook/create-react-app/blob/v3.4.1/packages/react-dev-utils/webpackHotDevClient.js
// https://github.com/facebook/create-react-app/blob/v3.4.1/packages/react-dev-utils/webpackHotDevClient.js
import
*
as
DevOverlay
from
'@next/react-dev-overlay/lib/client'
import
*
as
DevOverlay
from
'@next/react-dev-overlay/lib/client'
import
fetch
from
'next/dist/build/polyfills/unfetch'
import
*
as
ErrorOverlay
from
'next/dist/compiled/react-error-overlay'
import
stripAnsi
from
'next/dist/compiled/strip-ansi'
import
stripAnsi
from
'next/dist/compiled/strip-ansi'
import
{
getEventSourceWrapper
}
from
'./eventsource'
import
{
getEventSourceWrapper
}
from
'./eventsource'
import
formatWebpackMessages
from
'./format-webpack-messages'
import
formatWebpackMessages
from
'./format-webpack-messages'
import
{
rewriteStacktrace
}
from
'./source-map-support'
// This alternative WebpackDevServer combines the functionality of:
// This alternative WebpackDevServer combines the functionality of:
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
...
@@ -46,37 +43,7 @@ import { rewriteStacktrace } from './source-map-support'
...
@@ -46,37 +43,7 @@ import { rewriteStacktrace } from './source-map-support'
let
hadRuntimeError
=
false
let
hadRuntimeError
=
false
let
customHmrEventHandler
let
customHmrEventHandler
export
default
function
connect
(
options
)
{
export
default
function
connect
(
options
)
{
// Open stack traces in an editor.
DevOverlay
.
register
()
ErrorOverlay
.
setEditorHandler
(
function
editorHandler
({
fileName
,
lineNumber
,
colNumber
,
})
{
// Resolve invalid paths coming from react-error-overlay
const
resolvedFilename
=
fileName
.
replace
(
/^webpack:
\/\/
/
,
''
)
fetch
(
'/_next/development/open-stack-frame-in-editor'
+
`?fileName=
${
window
.
encodeURIComponent
(
resolvedFilename
)}
`
+
`&lineNumber=
${
lineNumber
||
1
}
`
+
`&colNumber=
${
colNumber
||
1
}
`
)
})
if
(
process
.
env
.
__NEXT_FAST_REFRESH
)
{
DevOverlay
.
register
()
}
else
{
// We need to keep track of if there has been a runtime error.
// Essentially, we cannot guarantee application state was not corrupted by the
// runtime error. To prevent confusing behavior, we forcibly reload the entire
// application. This is handled below when we are notified of a compile (code
// change).
// See https://github.com/facebook/create-react-app/issues/3096
ErrorOverlay
.
startReportingRuntimeErrors
({
onError
:
function
()
{
hadRuntimeError
=
true
},
})
}
getEventSourceWrapper
(
options
).
addMessageListener
(
event
=>
{
getEventSourceWrapper
(
options
).
addMessageListener
(
event
=>
{
// This is the heartbeat event
// This is the heartbeat event
...
@@ -97,25 +64,6 @@ export default function connect(options) {
...
@@ -97,25 +64,6 @@ export default function connect(options) {
onUnrecoverableError
()
{
onUnrecoverableError
()
{
hadRuntimeError
=
true
hadRuntimeError
=
true
},
},
reportRuntimeError
(
err
)
{
if
(
process
.
env
.
__NEXT_FAST_REFRESH
)
{
return
}
ErrorOverlay
.
reportRuntimeError
(
err
)
},
prepareError
(
err
)
{
// Temporary workaround for https://github.com/facebook/create-react-app/issues/4760
// Should be removed once the fix lands
hadRuntimeError
=
true
// react-error-overlay expects a type of `Error`
const
error
=
new
Error
(
err
.
message
)
error
.
name
=
err
.
name
error
.
stack
=
err
.
stack
// __NEXT_DIST_DIR is provided by webpack
rewriteStacktrace
(
error
,
process
.
env
.
__NEXT_DIST_DIR
)
return
error
},
}
}
}
}
...
@@ -123,7 +71,6 @@ export default function connect(options) {
...
@@ -123,7 +71,6 @@ export default function connect(options) {
var
isFirstCompilation
=
true
var
isFirstCompilation
=
true
var
mostRecentCompilationHash
=
null
var
mostRecentCompilationHash
=
null
var
hasCompileErrors
=
false
var
hasCompileErrors
=
false
var
hmrEventCount
=
0
function
clearOutdatedErrors
()
{
function
clearOutdatedErrors
()
{
// Clean up outdated compile errors, if any.
// Clean up outdated compile errors, if any.
...
@@ -207,11 +154,7 @@ function handleErrors(errors) {
...
@@ -207,11 +154,7 @@ function handleErrors(errors) {
})
})
// Only show the first error.
// Only show the first error.
if
(
process
.
env
.
__NEXT_FAST_REFRESH
)
{
DevOverlay
.
onBuildError
(
formatted
.
errors
[
0
])
DevOverlay
.
onBuildError
(
formatted
.
errors
[
0
])
}
else
{
ErrorOverlay
.
reportBuildError
(
formatted
.
errors
[
0
])
}
// Also log them to the console.
// Also log them to the console.
if
(
typeof
console
!==
'undefined'
&&
typeof
console
.
error
===
'function'
)
{
if
(
typeof
console
!==
'undefined'
&&
typeof
console
.
error
===
'function'
)
{
...
@@ -230,21 +173,10 @@ function handleErrors(errors) {
...
@@ -230,21 +173,10 @@ function handleErrors(errors) {
}
}
}
}
function
tryDismissErrorOverlay
()
{
if
(
!
process
.
env
.
__NEXT_FAST_REFRESH
)
{
if
(
!
hasCompileErrors
)
{
ErrorOverlay
.
dismissBuildError
()
}
}
}
function
onFastRefresh
(
hasUpdates
)
{
function
onFastRefresh
(
hasUpdates
)
{
tryDismissErrorOverlay
()
DevOverlay
.
onBuildOk
()
if
(
process
.
env
.
__NEXT_FAST_REFRESH
)
{
if
(
hasUpdates
)
{
DevOverlay
.
onBuildOk
()
DevOverlay
.
onRefresh
()
if
(
hasUpdates
)
{
DevOverlay
.
onRefresh
()
}
}
}
console
.
log
(
'[Fast Refresh] done'
)
console
.
log
(
'[Fast Refresh] done'
)
...
@@ -261,13 +193,11 @@ function processMessage(e) {
...
@@ -261,13 +193,11 @@ function processMessage(e) {
const
obj
=
JSON
.
parse
(
e
.
data
)
const
obj
=
JSON
.
parse
(
e
.
data
)
switch
(
obj
.
action
)
{
switch
(
obj
.
action
)
{
case
'building'
:
{
case
'building'
:
{
++
hmrEventCount
console
.
log
(
'[Fast Refresh] rebuilding'
)
console
.
log
(
'[Fast Refresh] rebuilding'
)
break
break
}
}
case
'built'
:
case
'built'
:
case
'sync'
:
{
case
'sync'
:
{
if
(
obj
.
action
===
'built'
)
++
hmrEventCount
if
(
obj
.
hash
)
{
if
(
obj
.
hash
)
{
handleAvailableHash
(
obj
.
hash
)
handleAvailableHash
(
obj
.
hash
)
}
}
...
@@ -285,48 +215,6 @@ function processMessage(e) {
...
@@ -285,48 +215,6 @@ function processMessage(e) {
return
handleSuccess
()
return
handleSuccess
()
}
}
case
'typeChecked'
:
{
if
(
process
.
env
.
__NEXT_FAST_REFRESH
)
{
break
}
const
eventId
=
++
hmrEventCount
const
[{
errors
}]
=
obj
.
data
const
hasErrors
=
Boolean
(
errors
&&
errors
.
length
)
// Disregard event if there are no errors to report.
if
(
!
hasErrors
)
{
// We need to _try_ dismissing the error overlay, as code may not have
// changed, for example, when only types are updated.
// n.b. `handleSuccess` only dismisses the overlay if code was updated.
tryDismissErrorOverlay
()
break
}
function
display
()
{
// Another update has started, ignore type update:
if
(
!
canApplyUpdates
()
||
eventId
!==
hmrEventCount
)
{
return
}
// TypeScript errors to not take priority over compillation errors
if
(
hasCompileErrors
)
{
return
}
handleErrors
(
errors
)
}
// We need to defer this until we're in an idle state.
if
(
canApplyUpdates
())
{
display
()
}
else
{
afterApplyUpdates
(
display
)
}
break
}
default
:
{
default
:
{
if
(
customHmrEventHandler
)
{
if
(
customHmrEventHandler
)
{
customHmrEventHandler
(
obj
)
customHmrEventHandler
(
obj
)
...
...
packages/next/client/dev/error-overlay/source-map-support.ts
deleted
100644 → 0
View file @
9c799550
const
filenameRE
=
/
\(([^
)
]
+
\.
js
)
:
(\d
+
)
:
(\d
+
)\)
$/
export
function
rewriteStacktrace
(
e
:
Error
,
distDir
:
string
)
{
if
(
!
e
||
typeof
e
.
stack
!==
'string'
)
{
return
}
const
lines
=
e
.
stack
.
split
(
'
\
n'
)
const
result
=
lines
.
map
((
line
:
string
)
=>
{
return
rewriteTraceLine
(
line
,
distDir
)
})
e
.
stack
=
result
.
join
(
'
\
n'
)
}
function
rewriteTraceLine
(
trace
:
string
,
distDir
:
string
)
{
const
m
=
trace
.
match
(
filenameRE
)
if
(
m
==
null
)
{
return
trace
}
const
filename
=
m
[
1
]
const
filenameLink
=
filename
.
replace
(
distDir
,
'/_next/development'
)
.
replace
(
/
\\
/g
,
'/'
)
trace
=
trace
.
replace
(
filename
,
filenameLink
)
return
trace
}
packages/next/client/index.js
View file @
0d49f22e
...
@@ -152,13 +152,8 @@ class Container extends React.Component {
...
@@ -152,13 +152,8 @@ class Container extends React.Component {
return
this
.
props
.
children
return
this
.
props
.
children
}
}
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
process
.
env
.
__NEXT_FAST_REFRESH
)
{
const
{
ReactDevOverlay
}
=
require
(
'@next/react-dev-overlay/lib/client'
)
const
{
return
<
ReactDevOverlay
>
{
this
.
props
.
children
}
<
/ReactDevOverlay
>
ReactDevOverlay
,
}
=
require
(
'@next/react-dev-overlay/lib/client'
)
return
<
ReactDevOverlay
>
{
this
.
props
.
children
}
<
/ReactDevOverlay
>
}
return
this
.
props
.
children
}
}
}
}
}
}
...
@@ -323,28 +318,21 @@ export async function render(props) {
...
@@ -323,28 +318,21 @@ export async function render(props) {
export
function
renderError
(
props
)
{
export
function
renderError
(
props
)
{
const
{
App
,
err
}
=
props
const
{
App
,
err
}
=
props
// In development runtime errors are caught by
react-error-
overlay
// In development runtime errors are caught by
our
overlay
// In production we catch runtime errors using componentDidCatch which will trigger renderError
// In production we catch runtime errors using componentDidCatch which will trigger renderError
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
process
.
env
.
__NEXT_FAST_REFRESH
)
{
// A Next.js rendering runtime error is always unrecoverable
// A Next.js rendering runtime error is always unrecoverable
// FIXME: let's make this recoverable (error in GIP client-transition)
// FIXME: let's make this recoverable (error in GIP client-transition)
webpackHMR
.
onUnrecoverableError
()
webpackHMR
.
onUnrecoverableError
()
// We need to render an empty <App> so that the `<ReactDevOverlay>` can
// We need to render an empty <App> so that the `<ReactDevOverlay>` can
// render itself.
// render itself.
return
doRender
({
return
doRender
({
App
:
()
=>
null
,
App
:
()
=>
null
,
props
:
{},
props
:
{},
Component
:
()
=>
null
,
Component
:
()
=>
null
,
err
:
null
,
err
:
null
,
})
})
}
// Legacy behavior:
return
Promise
.
resolve
(
webpackHMR
.
reportRuntimeError
(
webpackHMR
.
prepareError
(
err
))
)
}
}
if
(
process
.
env
.
__NEXT_PLUGINS
)
{
if
(
process
.
env
.
__NEXT_PLUGINS
)
{
// eslint-disable-next-line
// eslint-disable-next-line
...
...
packages/next/next-server/server/config.ts
View file @
0d49f22e
...
@@ -52,7 +52,6 @@ const defaultConfig: { [key: string]: any } = {
...
@@ -52,7 +52,6 @@ const defaultConfig: { [key: string]: any } = {
workerThreads
:
false
,
workerThreads
:
false
,
basePath
:
''
,
basePath
:
''
,
pageEnv
:
false
,
pageEnv
:
false
,
reactRefresh
:
true
,
},
},
future
:
{
future
:
{
excludeDefaultMomentLocales
:
false
,
excludeDefaultMomentLocales
:
false
,
...
...
packages/next/package.json
View file @
0d49f22e
...
@@ -197,7 +197,6 @@
...
@@ -197,7 +197,6 @@
"postcss-loader"
:
"3.0.0"
,
"postcss-loader"
:
"3.0.0"
,
"postcss-preset-env"
:
"6.7.0"
,
"postcss-preset-env"
:
"6.7.0"
,
"raw-body"
:
"2.4.1"
,
"raw-body"
:
"2.4.1"
,
"react-error-overlay"
:
"5.1.6"
,
"recast"
:
"0.18.5"
,
"recast"
:
"0.18.5"
,
"resolve"
:
"1.11.0"
,
"resolve"
:
"1.11.0"
,
"send"
:
"0.17.1"
,
"send"
:
"0.17.1"
,
...
...
packages/next/server/error-debug.tsx
deleted
100644 → 0
View file @
9c799550
import
React
from
'react'
import
Head
from
'../next-server/lib/head'
// This component is only rendered on the server side.
export
default
function
ErrorDebug
({
error
,
info
,
}:
{
error
:
Error
info
:
any
})
{
return
(
<
div
style=
{
styles
.
errorDebug
as
object
}
>
<
Head
>
<
meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
</
Head
>
<
StackTrace
error=
{
error
}
info=
{
info
}
/>
</
div
>
)
}
const
StackTrace
=
({
error
:
{
name
,
message
,
stack
},
info
,
}:
{
error
:
Error
info
:
any
})
=>
(
<
div
>
<
div
style=
{
styles
.
heading
as
object
}
>
{
message
||
name
}
</
div
>
<
pre
style=
{
styles
.
stack
as
object
}
>
{
stack
}
</
pre
>
{
info
&&
<
pre
style=
{
styles
.
stack
as
object
}
>
{
info
.
componentStack
}
</
pre
>
}
</
div
>
)
export
const
styles
=
{
errorDebug
:
{
background
:
'#ffffff'
,
boxSizing
:
'border-box'
,
overflow
:
'auto'
,
padding
:
'24px'
,
position
:
'fixed'
,
left
:
0
,
right
:
0
,
top
:
0
,
bottom
:
0
,
zIndex
:
9999
,
color
:
'#000000'
,
},
stack
:
{
fontFamily
:
'"SF Mono", "Roboto Mono", "Fira Mono", consolas, menlo-regular, monospace'
,
fontSize
:
'13px'
,
lineHeight
:
'18px'
,
color
:
'#777'
,
margin
:
0
,
whiteSpace
:
'pre-wrap'
,
wordWrap
:
'break-word'
,
marginTop
:
'16px'
,
},
heading
:
{
fontFamily
:
'-apple-system, system-ui, BlinkMacSystemFont, Roboto, "Segoe UI", "Fira Sans", Avenir, "Helvetica Neue", "Lucida Grande", sans-serif'
,
fontSize
:
'20px'
,
fontWeight
:
'400'
,
lineHeight
:
'28px'
,
color
:
'#000000'
,
marginBottom
:
'0px'
,
marginTop
:
'0px'
,
},
}
packages/next/server/hot-reloader.ts
View file @
0d49f22e
...
@@ -488,7 +488,6 @@ export default class HotReloader {
...
@@ -488,7 +488,6 @@ export default class HotReloader {
pagesDir
:
this
.
pagesDir
,
pagesDir
:
this
.
pagesDir
,
reload
:
this
.
reload
.
bind
(
this
),
reload
:
this
.
reload
.
bind
(
this
),
pageExtensions
:
this
.
config
.
pageExtensions
,
pageExtensions
:
this
.
config
.
pageExtensions
,
hotRouterUpdates
:
this
.
config
.
experimental
.
reactRefresh
!==
true
,
...(
this
.
config
.
onDemandEntries
as
{
...(
this
.
config
.
onDemandEntries
as
{
maxInactiveAge
:
number
maxInactiveAge
:
number
pagesBufferLength
:
number
pagesBufferLength
:
number
...
...
packages/next/server/next-dev-server.ts
View file @
0d49f22e
...
@@ -28,7 +28,6 @@ import { normalizePagePath } from '../next-server/server/normalize-page-path'
...
@@ -28,7 +28,6 @@ import { normalizePagePath } from '../next-server/server/normalize-page-path'
import
Router
,
{
Params
,
route
}
from
'../next-server/server/router'
import
Router
,
{
Params
,
route
}
from
'../next-server/server/router'
import
{
eventCliSession
}
from
'../telemetry/events'
import
{
eventCliSession
}
from
'../telemetry/events'
import
{
Telemetry
}
from
'../telemetry/storage'
import
{
Telemetry
}
from
'../telemetry/storage'
import
ErrorDebug
from
'./error-debug'
import
HotReloader
from
'./hot-reloader'
import
HotReloader
from
'./hot-reloader'
import
{
findPageFile
}
from
'./lib/find-page-file'
import
{
findPageFile
}
from
'./lib/find-page-file'
import
{
getNodeOptionsWithoutInspect
}
from
'./lib/utils'
import
{
getNodeOptionsWithoutInspect
}
from
'./lib/utils'
...
@@ -49,10 +48,7 @@ export default class DevServer extends Server {
...
@@ -49,10 +48,7 @@ export default class DevServer extends Server {
constructor
(
options
:
ServerConstructor
&
{
isNextDevCommand
?:
boolean
})
{
constructor
(
options
:
ServerConstructor
&
{
isNextDevCommand
?:
boolean
})
{
super
({
...
options
,
dev
:
true
})
super
({
...
options
,
dev
:
true
})
this
.
renderOpts
.
dev
=
true
this
.
renderOpts
.
dev
=
true
;(
this
.
renderOpts
as
any
).
ErrorDebug
=
;(
this
.
renderOpts
as
any
).
ErrorDebug
=
ReactDevOverlay
this
.
nextConfig
.
experimental
?.
reactRefresh
===
true
?
ReactDevOverlay
:
ErrorDebug
this
.
devReady
=
new
Promise
(
resolve
=>
{
this
.
devReady
=
new
Promise
(
resolve
=>
{
this
.
setDevReady
=
resolve
this
.
setDevReady
=
resolve
})
})
...
...
packages/next/server/on-demand-entry-handler.ts
View file @
0d49f22e
...
@@ -48,7 +48,6 @@ export default function onDemandEntryHandler(
...
@@ -48,7 +48,6 @@ export default function onDemandEntryHandler(
pageExtensions
,
pageExtensions
,
maxInactiveAge
,
maxInactiveAge
,
pagesBufferLength
,
pagesBufferLength
,
hotRouterUpdates
,
}:
{
}:
{
buildId
:
string
buildId
:
string
pagesDir
:
string
pagesDir
:
string
...
@@ -56,7 +55,6 @@ export default function onDemandEntryHandler(
...
@@ -56,7 +55,6 @@ export default function onDemandEntryHandler(
pageExtensions
:
string
[]
pageExtensions
:
string
[]
maxInactiveAge
:
number
maxInactiveAge
:
number
pagesBufferLength
:
number
pagesBufferLength
:
number
hotRouterUpdates
:
boolean
}
}
)
{
)
{
const
{
compilers
}
=
multiCompiler
const
{
compilers
}
=
multiCompiler
...
@@ -90,7 +88,6 @@ export default function onDemandEntryHandler(
...
@@ -90,7 +88,6 @@ export default function onDemandEntryHandler(
const
pageLoaderOpts
:
ClientPagesLoaderOptions
=
{
const
pageLoaderOpts
:
ClientPagesLoaderOptions
=
{
page
,
page
,
absolutePagePath
,
absolutePagePath
,
hotRouterUpdates
,
}
}
return
addEntry
(
compilation
,
compiler
.
context
,
name
,
[
return
addEntry
(
compilation
,
compiler
.
context
,
name
,
[
compiler
.
name
===
'client'
compiler
.
name
===
'client'
...
...
packages/next/taskfile.js
View file @
0d49f22e
...
@@ -523,22 +523,9 @@ export async function path_to_regexp(task, opts) {
...
@@ -523,22 +523,9 @@ export async function path_to_regexp(task, opts) {
.
source
(
opts
.
src
||
relative
(
__dirname
,
require
.
resolve
(
'path-to-regexp'
)))
.
source
(
opts
.
src
||
relative
(
__dirname
,
require
.
resolve
(
'path-to-regexp'
)))
.
target
(
'dist/compiled/path-to-regexp'
)
.
target
(
'dist/compiled/path-to-regexp'
)
}
}
externals
[
'react-error-overlay'
]
=
'next/dist/compiled/react-error-overlay'
export
async
function
react_error_overlay
(
task
,
opts
)
{
await
task
.
source
(
opts
.
src
||
relative
(
__dirname
,
require
.
resolve
(
'react-error-overlay'
))
)
.
target
(
'dist/compiled/react-error-overlay'
)
}
export
async
function
precompile
(
task
)
{
export
async
function
precompile
(
task
)
{
await
task
.
parallel
([
await
task
.
parallel
([
'browser_polyfills'
,
'path_to_regexp'
,
'copy_ncced'
])
'browser_polyfills'
,
'path_to_regexp'
,
'react_error_overlay'
,
'copy_ncced'
,
])
}
}
// eslint-disable-next-line camelcase
// eslint-disable-next-line camelcase
...
...
test/integration/client-navigation/test/index.test.js
View file @
0d49f22e
...
@@ -949,7 +949,7 @@ describe('Client Navigation', () => {
...
@@ -949,7 +949,7 @@ describe('Client Navigation', () => {
})
})
describe
(
'runtime errors'
,
()
=>
{
describe
(
'runtime errors'
,
()
=>
{
it
(
'should show re
act-error-overlay
when a client side error is thrown inside a component'
,
async
()
=>
{
it
(
'should show re
dbox
when a client side error is thrown inside a component'
,
async
()
=>
{
let
browser
let
browser
try
{
try
{
browser
=
await
webdriver
(
context
.
appPort
,
'/error-inside-browser-page'
)
browser
=
await
webdriver
(
context
.
appPort
,
'/error-inside-browser-page'
)
...
@@ -964,7 +964,7 @@ describe('Client Navigation', () => {
...
@@ -964,7 +964,7 @@ describe('Client Navigation', () => {
}
}
})
})
it
(
'should show re
act-error-overlay
when a client side error is thrown outside a component'
,
async
()
=>
{
it
(
'should show re
dbox
when a client side error is thrown outside a component'
,
async
()
=>
{
let
browser
let
browser
try
{
try
{
browser
=
await
webdriver
(
browser
=
await
webdriver
(
...
...
yarn.lock
View file @
0d49f22e
...
@@ -14118,11 +14118,6 @@ react-dom@16.12.0:
...
@@ -14118,11 +14118,6 @@ react-dom@16.12.0:
prop-types "^15.6.2"
prop-types "^15.6.2"
scheduler "^0.18.0"
scheduler "^0.18.0"
react-error-overlay@5.1.6:
version "5.1.6"
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-5.1.6.tgz#0cd73407c5d141f9638ae1e0c63e7b2bf7e9929d"
integrity sha512-X1Y+0jR47ImDVr54Ab6V9eGk0Hnu7fVWGeHQSOXHf/C2pF9c6uy3gef8QUeuUiWlNb0i08InPSE5a/KJzNzw1Q==
react-is@16.13.1, react-is@^16.7.0:
react-is@16.13.1, react-is@^16.7.0:
version "16.13.1"
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
...
...
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