module.setSourceMapsSupport(enabled[, options])


  • enabled <boolean> 启用源映射支持。

    ¥enabled <boolean> Enable the source map support.

  • options <Object> 可选的

    ¥options <Object> Optional

    • nodeModules <boolean> 如果在 node_modules 中启用对文件的支持。默认值:false

      ¥nodeModules <boolean> If enabling the support for files in node_modules. Default: false.

    • generatedCode <boolean> 如果启用对 evalnew Function 生成代码的支持。默认值:false

      ¥generatedCode <boolean> If enabling the support for generated code from eval or new Function. Default: false.

此函数启用或禁用 源映射 v3 对堆栈跟踪的支持。

¥This function enables or disables the Source Map v3 support for stack traces.

它提供与使用命令行选项 --enable-source-maps 启动 Node.js 进程相同的功能,并带有用于更改对 node_modules 中的文件或生成代码的支持的附加选项。

¥It provides same features as launching Node.js process with commandline options --enable-source-maps, with additional options to alter the support for files in node_modules or generated codes.

只有在启用源映射后加载的 JavaScript 文件中的源映射才会被解析和加载。最好使用命令行选项 --enable-source-maps 以避免丢失在此 API 调用之前加载的模块的源映射。

¥Only source maps in JavaScript files that are loaded after source maps has been enabled will be parsed and loaded. Preferably, use the commandline options --enable-source-maps to avoid losing track of source maps of modules loaded before this API call.