Skip to content

Commit

Permalink
Open IDE from React Error Overlay page links (#1098)
Browse files Browse the repository at this point in the history
* Change editor handler URL

* Add changeset

Co-authored-by: Cristiano Belloni <cristiano.belloni@jpmorgan.com>
  • Loading branch information
cristiano-belloni and Cristiano Belloni authored Nov 25, 2021
1 parent 90d5172 commit f6a7d8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twelve-news-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'modular-scripts': patch
---

Open IDE from React Error Overlay page links
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let hasCompileErrors = false;
setEditorHandler(function editorHandler(errorLocation) {
// Keep this sync with errorOverlayMiddleware.js
void fetch(
'/__open_editor' +
'/__open-stack-frame-in-editor' +
'?fileName=' +
window.encodeURIComponent(errorLocation.fileName) +
'&lineNumber=' +
Expand Down
3 changes: 3 additions & 0 deletions packages/modular-scripts/src/esbuild-scripts/start/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { createIndex } from '../api';
import { formatError } from '../utils/formatError';
import createEsbuildConfig from '../config/createEsbuildConfig';
import { createAbsoluteSourceMapMiddleware } from '../utils/absoluteSourceMapsMiddleware';
import createLaunchEditorMiddleware from '../../../react-dev-utils/errorOverlayMiddleware.js';

class DevServer {
private paths: Paths;
Expand Down Expand Up @@ -68,6 +69,8 @@ class DevServer {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.express.get('/', this.handleIndex);

this.express.use(createLaunchEditorMiddleware());

this.ws.app.ws('/_ws', (ws, req) => {
logger.debug('Connected');
});
Expand Down

0 comments on commit f6a7d8d

Please sign in to comment.