-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack trace filenames are different when running from SBT #20
Comments
I did not know that Node.js had introduced their own You can do so today even from sbt with jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(
org.scalajs.jsenv.nodejs.NodeJSEnv.Config()
.withSourceMap(false).withArgs(List("--enable-source-maps"))) |
Oh, I didn't realize you were using something else? Edit: scratch that, I've just been confused by these two different source maps features :) |
Hmm, I tried your suggestion of |
Note that inside NodeJSEnv we execute scripts using the |
Thanks. Not sure if the native sourcemaps work with the They recommend using the V8 stack trace API to customize it, which I assume is what you might already be doing in NodeJSEnv? |
Nope :) scala-js-js-envs/nodejs-env/src/main/scala/org/scalajs/jsenv/nodejs/NodeJSEnv.scala Lines 104 to 107 in 01b0e95
|
Hmm. Maybe |
It more feels like the path mangling / unmangling is broken. Maybe it assumes that we give it a relative path in |
Oh, for sure. I was disappointed that this workaround didn't work: jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(
org.scalajs.jsenv.nodejs.NodeJSEnv.Config()
.withSourceMap(false).withArgs(List("--enable-source-maps"))) It might have to do with the VM thing. |
I'm having a more detailed look at this. For starters, I'm going to transfer this to https://github.com/scala-js/scala-js-js-envs, because the issue is almost certainly there. Also, we need to test things there anyways :) |
Well... So it seems this is a known issue (since 2015): evanw/node-source-map-support#84 Now, the question is why it works in the case you pass a single file. |
Thanks for looking into this! The case where it works, it's not using the source-map-support package. It's using Node.js builtin source map implementation. It would be amazing if you could switch the env to use that instead, so we don't have to install the npm package everywhere :) |
OK, I can reproduce this on node 14 onward (node 12 seems to have the same issue with the |
What I have found out so far:
@sjrd, any thoughts you have would be appreciated. |
Cats Effect isn't strictly necessary for a minimization, but here it helps demonstrate how this issue affects published source maps.
Running within sbt I get:
Notice how the filenames are prepended with my workspace and also the URL has lost a slash. If I run directly with
node --enable-source-maps
I get:The text was updated successfully, but these errors were encountered: