Skip to content

--enable-source-maps does not appear to show function names with webpack sourcemaps #35325

Closed
@michael-wolfenden

Description

@michael-wolfenden
  • 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)

Metadata

Metadata

Assignees

Labels

source mapsIssues and PRs related to source map support.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions