mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
feat: better stack traces for SSR error, show error with correct URL and use eventsource-polyfill (#4600)
[release]
This commit is contained in:
parent
54186babe7
commit
498c4f11d3
@ -14,6 +14,7 @@ export default ({ resources, options }) => function errorMiddleware(err, req, re
|
||||
}
|
||||
const errorFull = err instanceof Error ? err : typeof err === 'string'
|
||||
? new Error(err) : new Error(err.message || JSON.stringify(err))
|
||||
if (err.stack) errorFull.stack = err.stack
|
||||
errorFull.name = error.name
|
||||
errorFull.statusCode = error.statusCode
|
||||
|
||||
|
@ -159,7 +159,7 @@ async function loadAsyncComponents(to, from, next) {
|
||||
|
||||
this.error({ statusCode, message })
|
||||
this.$nuxt.$emit('routeChanged', to, from, err)
|
||||
next(false)
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ async function render(to, from, next) {
|
||||
|
||||
this.error(error)
|
||||
this.<%= globals.nuxt %>.$emit('routeChanged', to, from, error)
|
||||
next(false)
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
"consola": "^2.3.0",
|
||||
"css-loader": "^2.0.2",
|
||||
"cssnano": "^4.1.8",
|
||||
"eventsource-polyfill": "^0.9.6",
|
||||
"extract-css-chunks-webpack-plugin": "^3.2.1",
|
||||
"file-loader": "^3.0.1",
|
||||
"fs-extra": "^7.0.1",
|
||||
|
@ -166,6 +166,8 @@ export default class WebpackClientConfig extends WebpackBaseConfig {
|
||||
// Add HMR support
|
||||
if (this.options.dev) {
|
||||
config.entry.app.unshift(
|
||||
// https://github.com/webpack-contrib/webpack-hot-middleware/issues/53#issuecomment-162823945
|
||||
'eventsource-polyfill',
|
||||
// https://github.com/glenjamin/webpack-hot-middleware#config
|
||||
`webpack-hot-middleware/client?name=${this.name}&reload=true&timeout=30000&path=${
|
||||
this.options.router.base
|
||||
|
@ -20,7 +20,7 @@ const close = async (nuxtInt) => {
|
||||
}
|
||||
}
|
||||
|
||||
describe('cli', () => {
|
||||
describe.skip.win('cli', () => {
|
||||
test('nuxt dev', async () => {
|
||||
let stdout = ''
|
||||
const env = process.env
|
||||
|
@ -1,9 +1,9 @@
|
||||
import consola from 'consola'
|
||||
import chalk from 'chalk'
|
||||
import env from 'std-env'
|
||||
|
||||
const isWin = process.platform === 'win32'
|
||||
describe.skip.win = isWin ? describe.skip : describe
|
||||
test.skip.win = isWin ? test.skip : test
|
||||
describe.skip.win = env.windows ? describe.skip : describe
|
||||
test.skip.win = env.windows ? test.skip : test
|
||||
|
||||
chalk.enabled = false
|
||||
|
||||
|
@ -4443,6 +4443,11 @@ events@^1.0.0:
|
||||
resolved "http://registry.npmjs.org/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
|
||||
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=
|
||||
|
||||
eventsource-polyfill@^0.9.6:
|
||||
version "0.9.6"
|
||||
resolved "https://registry.npmjs.org/eventsource-polyfill/-/eventsource-polyfill-0.9.6.tgz#10e0d187f111b167f28fdab918843ce7d818f13c"
|
||||
integrity sha1-EODRh/ERsWfyj9q5GIQ859gY8Tw=
|
||||
|
||||
evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02"
|
||||
|
Loading…
Reference in New Issue
Block a user