Skip to content

Commit 737f6c0

Browse files
committed
add support for debugging external node internals
1 parent 8355f70 commit 737f6c0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/targets/node/nodeSourcePathResolver.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ export class NodeSourcePathResolver extends SourcePathResolverBase<IOptions> {
3838
// replace any query string, which can be generated by webpack bundles
3939
url = url.replace(/\?.+/, '');
4040

41+
// Allow debugging of externally loaded Node internals
42+
// [ by building Node with ./configure --node-builtin-modules-path $(pwd) ]
43+
if (url.startsWith('node:')) {
44+
url = url.replace('node:', this.options.basePath + '/lib/');
45+
if (!url.endsWith('.js')) url += '.js';
46+
}
47+
4148
if (map) {
4249
return this.sourceMapSourceToAbsolute(url, map);
4350
}

0 commit comments

Comments
 (0)