Skip to content

Commit

Permalink
Move error overlay middleware (facebook#2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed May 18, 2017
1 parent 1e06ec9 commit cffb981
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// @remove-on-eject-end
'use strict';

const launchEditor = require('react-dev-utils/launchEditor');
const errorOverlayMiddleware = require('react-error-overlay/middleware');
const config = require('./webpack.config.dev');
const paths = require('./paths');

Expand Down Expand Up @@ -70,15 +70,8 @@ module.exports = function(proxy, allowedHost) {
public: allowedHost,
proxy,
setup(app) {
// This lets us open files from the crash overlay.
app.use(function launchEditorMiddleware(req, res, next) {
if (req.url.startsWith('/__open-stack-frame-in-editor')) {
launchEditor(req.query.fileName, req.query.lineNumber);
res.end();
} else {
next();
}
});
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
},
};
};

0 comments on commit cffb981

Please sign in to comment.