script.sourceMapURL
新增于: v19.1.0, v18.13.0
当脚本从包含源映射魔术注释的源编译时,此属性将设置为源映射的 URL。
\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.
import vm from 'node:vm'; const script = new vm.Script(` function myFunc() {} //# sourceMappingURL=sourcemap.json `); console.log(script.sourceMapURL); // Prints: sourcemap.jsonconst vm = require('node:vm'); const script = new vm.Script(` function myFunc() {} //# sourceMappingURL=sourcemap.json `); console.log(script.sourceMapURL); // Prints: sourcemap.json