You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I noticed that I seem to be unable to resolve sourcemaps in Node. Here is a full repro with repro steps.
Notice that, in my repro web app, Chrome is able to parse the stacktrace for script.min.js (source: script.js), so the sourcemap seems to be configured correctly:
Yet, in Node.js, when I run:
conststacktrace="Error\n at http://localhost:3000/script.min.js:1:29"console.log(newStacktracey(stacktrace).withSources().asTable())
The output is:
at script.min.js:1
Note that it says script.min.js, not script.js.
I believe I've tracked it down to these lines of code:
Note that, in the browser version of the code, it does an XHR to fetch the path – i.e. it assumes it's a URL, not a filepath. But in Node, it assumes it's a filepath. So we get a "no such file or directory" error:
It seems to me that the Node code should be making an HTTP request rather than doing fs.readFile / fs.readFileSync, similar to what it does in the browser.
The text was updated successfully, but these errors were encountered:
nolanlawson
changed the title
Cannot resolve sourcemaps in Node
Cannot resolve HTTP sourcemaps in Node
Dec 27, 2021
Hi, I noticed that I seem to be unable to resolve sourcemaps in Node. Here is a full repro with repro steps.
Notice that, in my repro web app, Chrome is able to parse the stacktrace for
script.min.js
(source:script.js
), so the sourcemap seems to be configured correctly:Yet, in Node.js, when I run:
The output is:
Note that it says
script.min.js
, notscript.js
.I believe I've tracked it down to these lines of code:
get-source/get-source.js
Line 146 in 02d7eec
get-source/get-source.js
Line 169 in 02d7eec
Note that, in the browser version of the code, it does an XHR to fetch the
path
– i.e. it assumes it's a URL, not a filepath. But in Node, it assumes it's a filepath. So we get a "no such file or directory" error:It seems to me that the Node code should be making an HTTP request rather than doing
fs.readFile
/fs.readFileSync
, similar to what it does in the browser.The text was updated successfully, but these errors were encountered: