Chrome是否在单个javascript网址上支持多个模块/ sourceMappingURL [英] Does Chrome support multiple modules/sourceMappingURLs on a single javascript url

查看:76
本文介绍了Chrome是否在单个javascript网址上支持多个模块/ sourceMappingURL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用Chrome中的源地图功能,并且发现它不支持将单个javascript资源附加到包含多个模块连接在一起的脚本标记以及 // @ sourceMappingURL 注释将每个分开

I have been trying out the Source Maps feature in Chrome and have found that it does not support having a single javascript resource attached to a script tag that contains multiple modules concatenated together along with a //@sourceMappingURL comment separating each one.

第一个映射被连接起来,我看到模块源关联在调试器,但所有其他都被忽略。

The first mapping is hooked up and I see the modules source associated in the debugger but all the others are ignored.

我希望当多个模块缩小并连接在一起时,这是一个注释要求

I would expect that it would be a comment requirement to do this when multiple modules are minified and concatenated together

支持方案吗?

推荐答案

Chrome DevTools不支持在单个文件中定义的多个sourceMappingURL。 (不幸的是,Pavel在2012年的回答是不正确的。)
相关地,Chrome也不支持单个文件中的多个sourceURL。

Chrome DevTools does not support multiple sourceMappingURLs defined in a single file. (Pavel's answer from 2012 is incorrect unfortunately.) Relatedly, Chrome also does not support multiple sourceURLs in a single file.

链接规范章节指的是sections数组,但是在单个父映射中定义,它映射整个文件。

The linked spec chapter refers to a sections array, but that's defined within a single parent map that addresses the entire file.

因此,如果您的代码如下所示:

Therefore, if your code looks like this:

// ... code()

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3V…  

},{"./bufferClone":99}],122:[function(require,module,exports){

// ... code()

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kd…
}

..那么你需要调整您的编译管道,因此最终捆绑文件只有一个地图。

.. then you'll need to adjust your compilation pipeline so there is only a single map for your final bundled file.

这篇关于Chrome是否在单个javascript网址上支持多个模块/ sourceMappingURL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆