Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How or Where does the browser get the source files for "sourcemapped" javascript files?

I am beginning work on an existing project, which is built using angular JS. When I open chrome dev tools "source" view, the browser tells me:

Source map detected...

and I see this:

enter image description here

Where

  • inline.bundle.js
  • main.bundle.js
  • etc...

are compiled files, whose original files are in the source directories Ive circled, e.g.

  • ng://
  • webpack://
  • etc..

The browser doesn't show any network requests for these ng://, webpack:// files, so my question is, where do these files come from? how is the browser obtaining this data?

Im guessing the server delivered a "sourcemap" file/s to the browser, which contained all the original source code and its corresponding compiled code? then the browser parsed the sourcemap and essentially generated a "virtual" file tree for these files - and thats why there is no network request? Where do these "files" come from?

like image 471
the_velour_fog Avatar asked Jan 30 '26 20:01

the_velour_fog


1 Answers

The sourcemaps could be baked into the original JS bundle, though it's not usually done in production.

It could also be an external file (usually referenced on the last line of the bundle).

Webpack allows all these different options through the devtool config option.

like image 83
Madd0g Avatar answered Feb 01 '26 12:02

Madd0g



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!