hot-reload: hide browserify's stack, enhance formatting

This commit is contained in:
jean-emmanuel 2018-10-20 10:29:26 +02:00
parent 39063693c2
commit ce27b8e052
2 changed files with 26 additions and 4 deletions

View file

@ -88,11 +88,18 @@ function bundle() {
output.on('error', (err)=> {
console.error(err.stack)
send('errorPopup', convert.toHtml(
'<div style="white-space:pre">' +
err.stack.replace(new RegExp(path.resolve(__dirname + '/..'), 'g'),'.').trim().replace('\n','\n\n') +
send('errorPopup',
'<div class="error-stack">' +
convert.toHtml(
err.stack
.replace(/\n\s*at Parser.*/g, '') // remove useless stack
.replace(new RegExp(path.resolve(__dirname + '/..'), 'g'),'.') // shorten file path
.trim()
.replace('\n','\n\n') // add 1 new line after 1st line
) +
'</div>'
))
)
})