diff --git a/doc/api/vm.md b/doc/api/vm.md index f99f4966db82b6..c79f8bc104a579 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -344,6 +344,29 @@ console.log(globalVar); // 1000 ``` +### `script.sourceMapURL` + + + +* {string|undefined} + +When the script is compiled from a source that contains a source map magic +comment, this property will be set to the URL of the source map. + +```js +const vm = require('node:vm'); + +const script = new vm.Script(` +function myFunc() {} +//# sourceMappingURL=sourcemap.json +`); + +console.log(script.sourceMapURL); +// Prints: sourcemap.json +``` + ## Class: `vm.Module`