How to fix Console error DevTools failed to load SourceMap

Introduction

DevTools is a set of tools for web developers which is a part of Chrome browser.

I was recently working on an interesting WordPress website and I have noticed a strange error in Console. I only saw this error in Chrome; no errors in Firefox for example.

This error was something like this: DevTools failed to load SourceMap: Could not load content for path/bootstrap-toggle.min.js.map: HTTP error: status code 404, net::ERRHTTP_RESPONSE_CODEFAILURE.

The solution for DevTools failed to load SourceMap error

It was frustrating to see this error because I had no reference to the file which was indicated in the error message: bootstrap-toggle.min.js.map. In other words the WordPress theme was not having any code to use such a file.

I searched the whole WP theme for the file and only found a comment in bootstrap-toggle.min.js file which was referring to the .map file: //# sourceMappingURL=bootstrap-toggle.min.js.map.

But since it was a comment it should have been just fine to leave it there.

The funny thing was that, once I have completely deleted that comment, the error was gone.

So, if you have tried anything and did not fix the DevTools load error, it is worthy to delete any comment you find in theme files which contains a reference to the .map file.

Conclusion

Please let me know if this is helpful for you and contact me if you need more info.

Comments closed

Please contact me, if you have any questions or suggestions.