import React from 'react' import Head from 'next/head' import ansiHTML from 'ansi-html' export default class ErrorDebug extends React.Component { static getInitialProps ({ err }) { const { name, message, stack, module } = err return { name, message, stack, path: module ? module.rawRequest : null } } render () { const { name, message, stack, path } = this.props return
{path ?
Error in {path}
: null} { name === 'ModuleBuildError' ?
        : 
{stack}
}
} } const encodeHtml = str => { return str.replace(//g, '>') } // see color definitions of babel-code-frame: // https://github.com/babel/babel/blob/master/packages/babel-code-frame/src/index.js ansiHTML.setColors({ reset: ['fff', 'a6004c'], darkgrey: 'e54590', yellow: 'ee8cbb', green: 'f2a2c7', magenta: 'fbe7f1', blue: 'fff', cyan: 'ef8bb9', red: 'fff' })