Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between inlineSourceMap & inlineSources typescript compiler options

Tags:

typescript

From the docs:

--inlineSourceMap and inlineSources command line options: --inlineSourceMap causes source map files to be written inline in the generated .js files instead of in a independent .js.map file. --inlineSources allows for additionally inlining the source .ts file into the .js file.

Does this mean the full file sources are written to the outputFile? Why would you want to do this? You can use the sourcemaps to reconstruct the original sources again anyway.

like image 614
klmdb Avatar asked Apr 08 '17 08:04

klmdb


1 Answers

Apparently, typescript sourcemaps' default behavior is to redirect the dev tools to the original source files, instead of including them into the sourcemaps.

This means that without inlineSourceMap: true, you are required to serve the original .ts files along with your bundled code.

Setting inlineSourceMap: true changes this default behavior to what I would've expected typescript to do out of the box: include the source info into the sourcemaps. This way, you don't need to serve the original source files along with the app bundle.

like image 79
klmdb Avatar answered Oct 08 '22 08:10

klmdb