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

查看:37
本文介绍了如果在 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.

Source maps 有助于调试代码.您在 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天全站免登陆