process.setSourceMapsEnabled(val)


此功能用于启用或禁用对堆栈跟踪的 源映射 支持。

【This function enables or disables the Source Map support for stack traces.】

它提供了与使用命令行选项 --enable-source-maps 启动 Node.js 进程相同的功能。

【It provides same features as launching Node.js process with commandline options --enable-source-maps.】

只有在启用源映射后加载的 JavaScript 文件中的源映射才会被解析和加载。

【Only source maps in JavaScript files that are loaded after source maps has been enabled will be parsed and loaded.】

这意味着调用 module.setSourceMapsSupport() 并传入选项 { nodeModules: true, generatedCode: true }

【This implies calling module.setSourceMapsSupport() with an option { nodeModules: true, generatedCode: true }.】