mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
pretty-error integration
This commit is contained in:
parent
5d0681088d
commit
ea33d83c2e
8
bin/nuxt
8
bin/nuxt
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const join = require('path').join
|
||||
require('../lib/common/errors')
|
||||
|
||||
const defaultCommand = 'dev'
|
||||
const commands = new Set([
|
||||
@ -21,11 +22,4 @@ if (commands.has(cmd)) {
|
||||
|
||||
const bin = join(__dirname, 'nuxt-' + cmd)
|
||||
|
||||
// Console error unhandled promises
|
||||
process.on('unhandledRejection', function (err) {
|
||||
/* eslint-disable no-console */
|
||||
console.error(err)
|
||||
console.error('[nuxt] Unhandled promise rejection: ' + err)
|
||||
})
|
||||
|
||||
require(bin)
|
||||
|
@ -14,7 +14,8 @@ const packageJSON = readJSONSync(resolve(rootDir, 'package.json'))
|
||||
|
||||
// Required and Excluded packages for start
|
||||
let requires = [
|
||||
'source-map-support'
|
||||
'source-map-support',
|
||||
'pretty-error'
|
||||
]
|
||||
|
||||
const excludes = [
|
||||
|
20
lib/common/errors.js
Normal file
20
lib/common/errors.js
Normal file
@ -0,0 +1,20 @@
|
||||
const PrettyError = require('pretty-error')
|
||||
|
||||
// Start default instance
|
||||
const pe = PrettyError.start()
|
||||
|
||||
// Configure prettyError instance
|
||||
pe.skipPackage('regenerator-runtime')
|
||||
pe.skipPackage('babel-runtime')
|
||||
pe.skipPackage('core-js')
|
||||
pe.skipNodeFiles()
|
||||
|
||||
// Console error unhandled promises
|
||||
process.on('unhandledRejection', function (err) {
|
||||
/* eslint-disable no-console */
|
||||
console.log(pe.render(err))
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
pe
|
||||
}
|
@ -97,6 +97,7 @@
|
||||
"minimist": "^1.2.0",
|
||||
"opencollective": "^1.0.3",
|
||||
"pify": "^3.0.0",
|
||||
"pretty-error": "^2.1.1",
|
||||
"progress-bar-webpack-plugin": "^1.10.0",
|
||||
"serialize-javascript": "^1.4.0",
|
||||
"serve-static": "^1.12.3",
|
||||
|
@ -48,6 +48,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map-support": "^0.4.15",
|
||||
"pretty-error": "^2.1.1",
|
||||
"lodash": "^4.17.4",
|
||||
"hash-sum": "^1.0.2",
|
||||
"tappable": "^1.1.0",
|
||||
|
@ -4944,7 +4944,7 @@ preserve@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
||||
|
||||
pretty-error@^2.0.2:
|
||||
pretty-error@^2.0.2, pretty-error@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
|
||||
dependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user