-
-
-
- {module ?
Error in {module.rawRequest}
: null}
- {
- name === 'ModuleBuildError'
- ?
- :
+// On the client side the error can come from multiple places for example react-hot-loader or client/index.js
+// `componentDidCatch` doesn't support asynchronous execution, so we have to handle sourcemap support here
+export class ClientDebug extends React.Component {
+ state = {
+ mappedError: null
+ }
+ componentDidMount () {
+ const {error} = this.props
+
+ // If sourcemaps were already applied there is no need to set the state
+ if (error.sourceMapsApplied) {
+ return
}
-
-)
-const StackTrace = ({ error: { name, message, stack } }) => (
+ // Since componentDidMount doesn't handle errors we use then/catch here
+ applySourcemaps(error).then(() => {
+ this.setState({mappedError: error})
+ }).catch(console.error)
+ }
+
+ render () {
+ const {mappedError} = this.state
+ const {error} = this.props
+ if (!error.sourceMapsApplied && mappedError === null) {
+ return