jquery - jQuery 源 map 何时加载?

标签 jquery load source-maps

我已经下载了最新的 jQuery 版本“jQuery 1.10.2”,从那时起我在 Chrome 中收到以下错误:

/jquery-1.10.2.min.map 404 (Not Found)

为了解决这个问题,我找到了 issue report其中解释说有一个 source map文件用于调试。

可能的修复方法之一是删除包含该文件的 jQuery js 中的注释,另一个方法是下载 map 文件。

我的问题是,如果源映射文件在加载时有用并帮助我调试,因为如果每次加载我的 jQuery 时都会加载它,那么为什么要使用库的最小版本,因为这个源 map 比未压缩版本更大?

最佳答案

源映射文件被 Chrome 调试器用来帮助开发人员调试缩小的脚本文件...

The idea is when you build for production, along with minifying and combining your JavaScript files, you generate a source map which holds information about your original files. When you query a certain line and column number in your generated JavaScript you can do a lookup in the source map which returns the original location. The DevTools can parse the source map automatically and make it appear as though you're running unminified and uncombined files.

read more here

因此,仅当调试器处于事件状态时才会加载 map 文件...这意味着该文件将仅在开发环境中加载,而不是在用户系统中加载

关于jquery - jQuery 源 map 何时加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18630131/

相关文章:

javascript - 选择下拉样式函数jquery

jquery - 使用 asp.net 在文件上传 jquery 插件中根据产品类型过滤图像

python - 从压缩字节加载 numpy 数组

gulp - source map 路径错误

带有源映射但没有 URL/引用的 Angular 构建

typescript - 在 Chrome DevTools 中看不到 ES6 和 TypeScript 库的源代码

javascript - 单击尖号时展开并折叠ul

javascript - 单击其中的项目时 Div 向上滑动

jquery - 在页面上加载某个 div 后,如何删除Class?

jquery - 图像加载后淡入