Source map error: Error: request failed with status 404 Resource URL
Asked Answered
F

1

5

I am getting an error:

HTML:

<link rel="stylesheet" href="https://www.domain123.com/wp-content/themes/gogo-theme/css/bootstrap.min.css">

Source map error: Error: request failed with status 404 Resource URL: https://www.domain123.com/wp-content/themes/gogo-theme/css/bootstrap.min.css Source Map URL: bootstrap.min.css.map

I can see the bootstrap boostrap.min.css file when I copy and paste the URL into the browser. Would would be the cause of the error? How do I fix it?

Froebel answered 4/5, 2023 at 2:15 Comment(0)
C
19

The message is not a fatal error, it is just indicating that the sourcemap (.map file) associated with the .js or .css resource could not be found (but the js or css files are being loaded).

For example: in https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js the last line reads:

//# sourceMappingURL=bootstrap.min.js.map

This indicates that there is an associated sourcemap file at https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js.map

The browser automatically tries to download this additional file (it's not neccesary, but is useful for debugging or accessing the source of the minified code).

Therefore, only the essential file (.css) may have been uploaded to the site, but not the associated .css.map file. You can find a way to include the file in the site or remove the last line from the file.

Cytogenetics answered 12/5, 2023 at 0:45 Comment(1)
Good answer. For more details on sourcemaps see https://mcmap.net/q/73481/-how-can-i-use-javascript-source-maps-map-filesCommunitarian

© 2022 - 2024 — McMap. All rights reserved.