1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

WIP: Fix devtoolModuleFilenames for react-error-overlay (#5055)

## Issue

Currently react-error-overlays launch-editor functionality doesn’t work because the module paths are in the wrong format.

## Todo

- [x] Keep source-maps enabled

## Related

https://github.com/zeit/next.js/pull/4979
This commit is contained in:
Henrik Wenz 2018-08-31 15:45:57 +02:00 committed by Tim Neutkens
parent 4ef3788613
commit b30a8b2e7c

View file

@ -55,9 +55,11 @@ let customHmrEventHandler
export default function connect (options) {
// Open stack traces in an editor.
ErrorOverlay.setEditorHandler(function editorHandler ({ fileName, lineNumber, colNumber }) {
// Resolve invalid paths coming from react-error-overlay
const resolvedFilename = fileName.replace(/^webpack:\/\//, '')
fetch(
'/_next/development/open-stack-frame-in-editor' +
`?fileName=${window.encodeURIComponent(fileName)}` +
`?fileName=${window.encodeURIComponent(resolvedFilename)}` +
`&lineNumber=${lineNumber || 1}` +
`&colNumber=${colNumber || 1}`
)