使用 eval 和 eval-source-map 有什么区别? [英] what's the difference using eval and eval-source-map?

查看:118
本文介绍了使用 eval 和 eval-source-map 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 webpack 来配置源映射.我想知道有人可以澄清eval"和eval-source-map"之间的区别吗?我个人看不出有什么不同.

I am using webpack to config the source map. I am wondering anyone could clarify the difference between "eval" and "eval-source-map" ? I don't see the difference personally.

推荐答案

来自文档:

eval - 每个模块都使用 eval() 和//@ sourceURL 执行.这是相当快.主要缺点是不显示线数字正确,因为它被映射到转译的代码而不是原始代码(没有来自加载程序的源映射).

eval - Each module is executed with eval() and //@ sourceURL. This is pretty fast. The main disadvantage is that it doesn't display line numbers correctly since it gets mapped to transpiled code instead of the original code (No Source Maps from Loaders).

eval-source-map - 每个模块都使用 eval() 和一个 SourceMap 执行作为 DataUrl 添加到 eval().起初它很慢,但它提供快速的重建速度并产生真实的文件.行号是正确映射,因为它被映射到原始代码.它产生用于开发的最优质 SourceMap.

eval-source-map - Each module is executed with eval() and a SourceMap is added as a DataUrl to the eval(). Initially it is slow, but it provides fast rebuild speed and yields real files. Line numbers are correctly mapped since it gets mapped to the original code. It yields the best quality SourceMaps for development.

本质上 eval-source-map 速度较慢,但​​对原始行号的映射更准确(有助于识别原始源代码中适当的错误行).

Essentially eval-source-map is slower, but has more accurate mapping to the original line numbers (helpful for identifying the appropriate lines of bugs in the original source code).

这篇关于使用 eval 和 eval-source-map 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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