When adding a JavaScript library, Chrome complains about a missing source map. Why?

Newer files on JsDelivr get the sourcemap added automatically to the end of them. This is fine and doesn’t throw any SourceMap-related notice in the console as long as you load the files from JsDelivr.

The problem occurs only when you copy and then load these files from your own server. In order to fix this for locally loaded files, simply remove the last line in the JavaScript file(s) downloaded from JsDelivr.

It should look something like this:

//# sourceMappingURL=/sm/64bec5fd901c75766b1ade899155ce5e1c28413a4707f0120043b96f4a3d8f80.map

As you can see, it’s commented out, but Chrome still parses it.

Leave a Comment