Closed
Description
Version
16.16.0
Platform
Linux 5.18.16-1rodete1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1rodete1 (2022-08-24) x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
server.js
"use strict";
let content = '';
content = '/*# sourceMappingURL=' + content + ' */';
throw new Error('This should point to TypeScript file.');
//# sourceMappingURL=server.js.map
server.js.map
{
"version": 3,
"file": "server.js",
"sourceRoot": "",
"sources": [
"../../server.ts"
],
"names": [],
"mappings": ";AAAA,IAAI,OAAO,GAAG,EAAE,CAAC;AACjB,OAAO,GAAG,uBAAuB,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC"
}
$ node --enable-source-maps server.js
Error: This should point to TypeScript file.
at Object.<anonymous> (/server.js:4:7)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Stacktrace points to the orginal source file when using --enable-source-maps
option.
What do you see instead?
Sourcemaps are not loaded when the files contains /*# sourceMappingURL=
as string literal and as such the stacktrace points to JavaScript output instead of the TypeScript source.
Additional information
No response