简体   繁体   English

如何防止Firefox DevTools显示“未找到源地图”错误?

[英]How to prevent Firefox DevTools from showing “Source Map not found” errors?

I am using a couple of 3rd party minified Javascript files that have no .map file. 我正在使用几个没有.map文件的第三方缩小的Javascript文件。 When I am debugging in Firefox DevTools, it consistently shows these errors: 当我在Firefox DevTools中调试时,它始终显示以下错误:

Source map error: request failed with status 404
Resource URL: https://foo.domain.com/widgets/widgets.min.js
Source Map URL: widgets.min.js.map

This is really distracting since there are a number of these files and they really pollute the console. 这真的让人分心,因为有很多这些文件,它们确实污染了控制台。

Is there anyway to turn these warnings off? 反正有没有关闭这些警告?

You can disable source maps globally by going into the Toolbox Options of the Developper Tools and unchecking Enable Source Maps . 您可以通过进入“开发人员工具”的“ Toolbox Options ”并取消选中“ Enable Source Maps全局禁用源Enable Source Maps

You can also provide an empty source map for some specific JavaScript files. 您还可以为某些特定的JavaScript文件提供空的源映射。 Use a local copy of the files (at least during development) and modify the source maps directive: 使用文件的本地副本(至少在开发期间)并修改源映射指令:

//# sourceMappingURL=http://example.com/path/to/your/sourcemap.map

by pointing to an empty source map file. 通过指向空的源映射文件。 You can also just remove the source map directive from the file. 您也可以从文件中删除源映射指令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM