Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the difference using eval and eval-source-map?

Tags:

webpack

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.

like image 233
Robert Li Avatar asked Jul 07 '18 14:07

Robert Li


1 Answers

From the documentation:

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 - 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.

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).

like image 117
P Ackerman Avatar answered Sep 18 '22 16:09

P Ackerman