Repository navigation
--enable-source-maps does not appear to show function names with webpack sourcemaps #35325
Copy link
Copy link
Closed
Closed
Copy link
Labels
source mapsIssues and PRs related to source map support.Issues and PRs related to source map support.
Description
- Version: v12.13.0
- Platform: Windows 10 64-bit
- Subsystem: sourcemaps
What steps will reproduce the bug?
Here is a complete, minimal reproduction
https://github.com/michael-wolfenden/node-sourcemap-repro
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
I would expect to see the real function names in the output.
Using the source-map-support package, the stack trace looks like:
> node ./dist/main.js
D:\github\node-sourcemap-repro\dist\webpack:\index-source-map-support.js:16
throw new Error('Roh Ruh')
^
Error: Roh Ruh
at functionD (D:\github\node-sourcemap-repro\dist\webpack:\index-source-map-support.js:16:9)
at functionC (D:\github\node-sourcemap-repro\dist\webpack:\index-source-map-support.js:12:3)
at functionB (D:\github\node-sourcemap-repro\dist\webpack:\index-source-map-support.js:8:3)
at Object.call (D:\github\node-sourcemap-repro\dist\webpack:\index-source-map-support.js:4:3)
at __webpack_require__ (D:\github\node-sourcemap-repro\dist\webpack:\webpack\bootstrap:19:22)
at D:\github\node-sourcemap-repro\dist\webpack:\webpack\bootstrap:83:10
at Object.<anonymous> (D:\github\node-sourcemap-repro\dist\main.js:1:911)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
What do you see instead?
Using the --enable-source-maps flag, the stack trace looks like:
> node --enable-source-maps ./dist/main.js
Error: Roh Ruh
at o (D:\github\node-sourcemap-repro\dist\main.js:1:970)
-> D:\github\node-sourcemap-repro\dist\webpack:\index.js:14:9
at n (D:\github\node-sourcemap-repro\dist\main.js:1:952)
-> D:\github\node-sourcemap-repro\dist\webpack:\index.js:10:3
at r (D:\github\node-sourcemap-repro\dist\main.js:1:940)
-> D:\github\node-sourcemap-repro\dist\webpack:\index.js:6:3
at Object.<anonymous> (D:\github\node-sourcemap-repro\dist\main.js:1:992)
-> D:\github\node-sourcemap-repro\dist\webpack:\index.js:2:3
at r (D:\github\node-sourcemap-repro\dist\main.js:1:110)
-> D:\github\node-sourcemap-repro\dist\webpack:\webpack\bootstrap:19:22
at D:\github\node-sourcemap-repro\dist\main.js:1:902
-> D:\github\node-sourcemap-repro\dist\webpack:\webpack\bootstrap:83:10
at Object.<anonymous> (D:\github\node-sourcemap-repro\dist\main.js:1:911)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
source mapsIssues and PRs related to source map support.Issues and PRs related to source map support.
Activity
bcoe commentedon Oct 30, 2020
@michael-wolfenden I'm wondering if you have any recommendations on how we should display the original function name?
The approach we've taken is to provide information about bot the call site with the error and the original call site, I'm wondering how we'd represent an alternate function name.
bcoe commentedon Oct 31, 2020
@michael-wolfenden what do you think of this?
michael-wolfenden commentedon Oct 31, 2020
I would expect the output to look something like the output that
source-map-supportgeneratesbcoe commentedon Oct 31, 2020
@michael-wolfenden we've opted to include both the call site where the error happened, and the original call site in our implementation of applying source maps to stack traces in Node.js.
This is useful because sometimes you do want to look at the actual location where the error was thrown, i.e.,
at o (/Users/bencoe/oss/node-1/test/fixtures/source-map/webpack.js:1:970)☝️ especially when using a minifier there can be bugs that only crop up in the minified code, e.g., a collision on symbol names.
I'd like to figure out a way to provide the original function name for you, without hiding the actual function name that executed.
errors: do not call resolve on URLs with schemes
michael-wolfenden commentedon Oct 31, 2020
Ah gotcha ... In that case, your suggestion looks good 👍
errors: do not call resolve on URLs with schemes
errors: display original symbol name
errors: display original symbol name
errors: do not call resolve on URLs with schemes
errors: do not call resolve on URLs with schemes
errors: display original symbol name
errors: display original symbol name
errors: display original symbol name