如何防止Firefox DevTools显示“未找到源地图”错误? [英] How to prevent Firefox DevTools from showing "Source Map not found" errors?

查看:137
本文介绍了如何防止Firefox DevTools显示“未找到源地图”错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用几个没有.map文件的第三方缩小的Javascript文件。当我在Firefox DevTools中调试时,它始终显示以下错误:

I am using a couple of 3rd party minified Javascript files that have no .map file. When I am debugging in Firefox DevTools, it consistently shows these errors:

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.

您还可以提供一些特定JavaScript文件的空源映射。使用文件的本地副本(至少在开发期间)并修改源映射指令:

You can also provide an empty source map for some specific JavaScript files. 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.

这篇关于如何防止Firefox DevTools显示“未找到源地图”错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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