Javascript 在 Chrome DevTools 中禁用源映射

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35002087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 17:09:20  来源:igfitidea点击:

Disable source maps in Chrome DevTools

javascriptgoogle-chromegoogle-chrome-devtoolssource-maps

提问by Hyman Allan

Is there a quick way to switch from the jsx code shown in Chrome DevTools to the raw ES5 and back again?

有没有一种快速的方法可以从 Chrome DevTools 中显示的 jsx 代码切换到原始 ES5 并再次切换回来?

回答by Garbee

Open Developer Tools, go to "Settings" for Developer Tools, then uncheck Enable JavaScript Sourcemapsunder the "Sources" settings.

打开开发者工具,转到开发者工具的“设置”,然后Enable JavaScript Sourcemaps在“来源”设置下取消选中。

Settings for Developer Tools

开发者工具设置

JS sourcemaps toggle

JS 源映射切换

回答by Scotty Waggoner

You can double click line numbers to jump from source files to unminified output files. Other than that it seems limited. See the comment below.

您可以双击行号从源文件跳转到未缩小的输出文件。除此之外,它似乎是有限的。请参阅下面的评论。

I found this to be useful during development. When using webpack-dev-server(or some other tooling) without minifying js, you can double click line numbers in the source files to jump to the compiled but unminified output file.

我发现这在开发过程中很有用。在使用webpack-dev-server(或其他一些工具)而不缩小 js 时,您可以双击源文件中的行号以跳转到已编译但未缩小的输出文件。

I just discovered this by accident and then found this comment from Dec 21, 2016: https://bugs.chromium.org/p/chromium/issues/detail?id=532174#c7

我只是偶然发现了这一点,然后在 2016 年 12 月 21 日找到了这条评论:https: //bugs.chromium.org/p/chromium/issues/detail?id=532174#c7

You can double click on the line number to jump into the original file, but that's pretty useless if the minified file has all newlines removed :(

Having word wrap would make this work better https://bugs.chromium.org/p/chromium/issues/detail?id=167287

I think there was some support for double clicking on a section of the minified file to jump into the source mapped file, but it seems to have regressed of late.

Ideally in a minified file with a source map, right clicking (or double clicking) anywhere in the minified file should allow jumping to that exact file, line and column

您可以双击行号以跳转到原始文件,但如果缩小的文件已删除所有换行符,那将毫无用处:(

自动换行会使这项工作更好 https://bugs.chromium.org/p/chromium/issues/detail?id=167287

我认为有一些支持双击缩小文件的一部分以跳转到源映射文件,但最近似乎已经倒退。

理想情况下,在带有源地图的缩小文件中,右键单击(或双击)缩小文件中的任意位置应该允许跳转到该确切的文件、行和列