SourceMap

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

SourceMap HTTP 响应头链接生成的代码到一个 source map,使浏览器能够重建原始的资源然后显示在调试器里。

Header 类型 Response header
Forbidden header name no

语法

SourceMap: <url>
X-SourceMap: <url> (deprecated)

指令

<url>

指向一个 source map 文件的一个相对(于请求的 URL)或者一个绝对的 URL。

例子

SourceMap: /path/to/file.js.map

规范

Specification
Source Map specification
# linking-generated-code

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
SourceMap

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.
Requires a vendor prefix or different name for use.
Has more compatibility info.

参见