如果在Angular中将sourcemap设置为false会发生什么 [英] What will happen if sourcemap is set as false in Angular

查看:594
本文介绍了如果在Angular中将sourcemap设置为false会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Angular的新手.我在tsconfig.json中看到了sourcemap,默认情况下为"sourceMap": true.我对此几乎没有疑问,并发现此链接很有用.仍然我对此有以下疑问.

I'm new in Angular. I saw sourcemap in tsconfig.json and by default it is "sourceMap": true. I had few doubts and found this link useful. Still I have the following doubt regarding the same.

我设置了"sourceMap": false,但是在应用程序中找不到任何更改.如果我这样设置的话,实际的变化是什么?

I set "sourceMap": false, but couldn't find any change in the app. What will be the actual change if I set so?

推荐答案

应用程序的运行方式将保持不变.

Nothing will change in how the app runs.

更改将在您的调试体验中进行.

The change will be in your debugging experience.

源地图对于调试代码很有帮助.您使用TypeScript编写代码,然后编译器将代码转换为JavaScript.当您的应用程序在Firefox之类的浏览器中运行时,该浏览器正在运行JavaScript.即使浏览器运行的是JavaScript,如果您在Firefox中打开调试器,调试器也会显示TypeScript源代码,并允许您在其中设置断点.由于源映射,调试器能够做到这一点,源映射将TypeScript源代码映射到JavaScript运行时代码.这就是源映射的作用:它们将源代码映射到运行时代码,以在运行时启用源代码调试.

Source maps are helpful for debugging code. You write your code in TypeScript, and the compiler turns that source code into JavaScript. When your app is running in a browser like Firefox, the browser is running the JavaScript. Even though the browser is running that JavaScript, if you open the debugger in Firefox, the debugger will display the TypeScript source code and will let you set break points in it. The debugger is able to do that because of source maps, which map the TypeScript source code to the JavaScript runtime code. That is what source maps do: they map the source code to the runtime code to enable source code debugging at runtime.

这篇关于如果在Angular中将sourcemap设置为false会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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