Who stole my SourceMaps?

Where is my source map? 😢

Prestory

The issue

Hunting down the problem

Why SystemJS?

https://cdn.bronto.com/application.12345.js
//# sourceMappingURL=application.12345.js.map

SourceMaps and `eval`

https://app.bronto.com/application.12345.js.map
https://cdn.bronto.com/application.12345.js.map

The solution

SourceMap path resolution rules:

  • “If the generated source is not associated with a script element that has a `src` attribute and there exists a //# sourceURL comment in the generated code, that comment should be used to determine the source origin.”
  • “If the generated code is associated with a script element and the script element has a `src` attribute, the `src` attribute of the script element will be the source origin.”
  • “If the generated code is associated with a script element and the script element does not have a `src` attribute, then the source origin will be the page’s origin.”
  • “If the generated code is being evaluated as a string with the eval() function or via new Function(), then the source origin will be the page’s origin.”

Conclusion

--

--

--

Senior Software Engineer @ Bronto + Oracle

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Build a REST API with Node.js and Express.js

A Simple Calc (pt.2)

Become a JavaScrip Guru | Array Functions

JWT Bearer token authentication for Express JS

Minimum Index Sum of Two Lists

Intro to TypeScript

Migrate AngularJS to Angular through Angular CLI + Hybrid application

Pancake Sorting in JavaScript

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Oleksiy Kvashchenko

Oleksiy Kvashchenko

Senior Software Engineer @ Bronto + Oracle

More from Medium

Masking Uploaded File Name

Create-React-App scripts explained

Bootstrap a frontend project with Primereact and Typescript

Document Object Model (DOM)