Source Map V3 的支持
稳定性: 1 - 实验
与源映射缓存交互的助手。 当启用源映射解析并且在模块的页脚中找到源映射包含指令时,则会填充此缓存。
要启用源映射解析,则 Node.js 必须使用标志 --enable-source-maps
运行、或者通过设置 NODE_V8_COVERAGE=dir
启用代码覆盖率。
// module.mjs
// 在 ECMAScript 模块中
import { findSourceMap, SourceMap } from 'node:module';
// module.cjs
// 在 CommonJS 模块中
const { findSourceMap, SourceMap } = require('node:module');
Stability: 1 - Experimental
Helpers for interacting with the source map cache. This cache is populated when source map parsing is enabled and source map include directives are found in a modules' footer.
To enable source map parsing, Node.js must be run with the flag
--enable-source-maps
, or with code coverage enabled by setting
NODE_V8_COVERAGE=dir
.
// module.mjs
// In an ECMAScript module
import { findSourceMap, SourceMap } from 'node:module';
// module.cjs
// In a CommonJS module
const { findSourceMap, SourceMap } = require('node:module');