I just added an "error boundary" to my React page with the "new" componentDidCatch
feature in React 16.
However, when an error is thrown it shows:
Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development.
The React team recommends I change my webpack devtool from eval
to cheap-module-source-map
.
This does indeed work.
However, if you look at the performance chart, you'll see cheap-module-source-map
is significantly slower than eval
for rebuild time.
I can't afford to have webpack-dev-server run any slower. It already takes about 10 seconds to rebuild after a single character change to one of my JSX files. This isn't on a slow laptop either.
Is there anyway to display the error without changing my webpack devtool?