Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error-overlay from CRA #1835

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/gatsby/package.json
Expand Up @@ -93,6 +93,7 @@
"raw-loader": "^0.5.1",
"react": "^15.6.0",
"react-dom": "^15.6.0",
"react-error-overlay": "^1.0.10",
"react-hot-loader": "^3.0.0-beta.6",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
Expand Down
4 changes: 4 additions & 0 deletions packages/gatsby/src/utils/develop.js
Expand Up @@ -96,6 +96,10 @@ async function startServer(program) {
})
)

app.use(
require(`react-error-overlay/middleware`)()
)

// Set up API proxy.
const { proxy } = store.getState().config
if (proxy) {
Expand Down
6 changes: 5 additions & 1 deletion packages/gatsby/src/utils/webpack.config.js
Expand Up @@ -124,6 +124,7 @@ module.exports = async (
`${require.resolve(
`webpack-hot-middleware/client`
)}?path=http://${program.host}:${webpackPort}/__webpack_hmr&reload=true`,
require.resolve(`react-error-overlay`),
directoryPath(`.cache/app`),
],
}
Expand Down Expand Up @@ -355,7 +356,10 @@ module.exports = async (
// Common config for every env.
config.loader(`js`, {
test: /\.jsx?$/, // Accept either .js or .jsx files.
exclude: /(node_modules|bower_components)/,
exclude: modulePath =>
// transpile react-error-overlay through babel since its not browser ready
/(node_modules|bower_components)/.test(modulePath)
&& !/react-error-overlay/.test(modulePath),
loader: `babel`,
query: babelConfig,
})
Expand Down