2

I have included quill.min.js in my site (I have no reference to quill.min.js.map on my site)

enter image description here

When I debug the site, I see the following warning:

DevTools failed to load SourceMap: Could not load content for my-site/Scripts/quill.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

enter image description here

Why am I getting this warning? quill.min.js.map does not exists on my server, I have only included quill.min.js. Do I need to include the map file on the server too?

Is this line: //# sourceMappingURL=quill.min.js.map just a comment or a reference to the map file? if it's a comment, then I don't any reference to the map file on my site.

Hooman Bahreini
  • 14,480
  • 11
  • 70
  • 137
  • Before someone will flag and close this post, please replace images with actually code (text). https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question – ulou May 25 '21 at 07:16
  • Remove `//# sourceMappingURL=quill.min.js.map`. https://stackoverflow.com/a/21719713/11151040 – BOZ May 25 '21 at 07:19
  • 1
    @BOZ: thanks so `//# sourceMappingURL=quill.min.js.map` is not a comment? – Hooman Bahreini May 25 '21 at 07:27
  • @ulou: the image is a minified library with thousands of characters... I cannot paste the whole library in the question. – Hooman Bahreini May 25 '21 at 07:30
  • 1
    @HoomanBahreini No, that's a comment. But inside the comment it is a readable variable. We can say that `# sourceMappingURL=` is detected by browsers. In short, if you are not in production or are using a library, you can clear this comment. The Warning it gives is not very important, but I don't know if it will technically affect performance. It is best to remove it. – BOZ May 25 '21 at 07:36

1 Answers1

4

A .map file is just a "helper" for debugging. If you have a "minified" JS-file (which is mostly the case in production environments), the .map file, as the name says, maps it to a better human-readable version.

So, in short, there is no need to have that file on you production server and you can ignore the warning there. (Indeed having it in production should be avoided.) But it is helpful in development environments.

The //# sourceMappingURL=quill.min.js.map indeed is both a comment and additionally has an own semantic which is evaluated by a browser to indicate the path to the map file for debugging purposes. Nevertheless, you can (and, in this case, should) securely remove it.

ahuemmer
  • 1,653
  • 9
  • 22
  • 29
  • Thanks, so `//# sourceMappingURL=quill.min.js.map` is not a comment, it's actually indicating that `quill.min.js.map` is the name of the map file? – Hooman Bahreini May 25 '21 at 07:24
  • Indeed, it's both, as also BOZ stated above. :) I updated my answer accordingly. – ahuemmer May 25 '21 at 08:12
  • Chrome asks for a .map file for .min.js files if you have the DevTools (right click / Inspect or F12) tab open. – lolesque Apr 05 '23 at 14:25