File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const chalk = require('chalk');
14
14
const dns = require ( 'dns' ) ;
15
15
const historyApiFallback = require ( 'connect-history-api-fallback' ) ;
16
16
const httpProxyMiddleware = require ( 'http-proxy-middleware' ) ;
17
+ const launchEditor = require ( 'react-dev-utils/launchEditor' ) ;
17
18
const url = require ( 'url' ) ;
18
19
const paths = require ( '../../config/paths' ) ;
19
20
@@ -145,10 +146,23 @@ function registerProxy(devServer, _proxy) {
145
146
} ) ;
146
147
}
147
148
149
+ // This is used by the crash overlay.
150
+ function launchEditorMiddleware ( ) {
151
+ return function ( req , res , next ) {
152
+ if ( req . url . startsWith ( '/__open-stack-frame-in-editor' ) ) {
153
+ launchEditor ( req . query . fileName , req . query . lineNumber ) ;
154
+ res . end ( ) ;
155
+ } else {
156
+ next ( ) ;
157
+ }
158
+ } ;
159
+ }
160
+
148
161
module . exports = function addWebpackMiddleware ( devServer ) {
149
162
// `proxy` lets you to specify a fallback server during development.
150
163
// Every unrecognized request will be forwarded to it.
151
164
const proxy = require ( paths . appPackageJson ) . proxy ;
165
+ devServer . use ( launchEditorMiddleware ( ) ) ;
152
166
devServer . use (
153
167
historyApiFallback ( {
154
168
// Paths with dots should still use the history fallback.
You can’t perform that action at this time.
0 commit comments