Bug 27651 - Warning of missing Bootstrap source map
Summary: Warning of missing Bootstrap source map
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-08 10:47 UTC by Andrew Isherwood
Modified: 2023-12-28 20:42 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Isherwood 2021-02-08 10:47:33 UTC
Chrome Dev Tools is warning of a missing Bootstrap source map in the OPAC:

DevTools failed to load SourceMap: Could not load content for https://xxxxx/opac-tmpl/bootstrap/lib/bootstrap/js/bootstrap.bundle.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

(The xxxxx replaced the actual OPAC domain)

I wouldn't have thought we would want to be referencing source maps in production, but I don't know if Bootstrap does that by default or whether we should be using a production build that doesn't reference it.
Comment 1 Owen Leonard 2021-02-08 11:36:35 UTC
I think this is essentially a duplicate of Bug 26471. Several minified JS files in Koha include comments which are intended to point to source map files if they are available, for instance

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

If you have the Chrome dev tools open, Chrome assumes you want it to look for this map to help you with JavaScript debugging. When it doesn't find one it tells you so. This isn't an error which has any consequence to the end user. I don't know why Chrome chooses to warn you about missing source maps and Firefox doesn't.

The options for addressing the error:

1. Don't address the error. It only appears if you are inspecting the source in Chrome dev tools.

2. Modify each minified JavaScript file we get from third-party sources which include sourceMappingURL.

3. Build our own minified JavaScript files for each JS library and include the option to generate source maps.

My vote is #1, and WONTFIX.
Comment 2 Andrew Isherwood 2021-02-08 13:19:07 UTC
I'd add another option to that:

4. Build our own minified JavaScript files for Bootstrap and pass build options to not generate (and thus, not reference) source maps.

The only reason the error is being generated is that the Bootstrap we're using has been built with source maps enabled and the path (as you mentioned, in the comment in the JS file) to the map in question is wrong, the file is there, it's just not accessible. It's a good job it's not accessible because it's 309K in size.

As far as I can see, Bootstrap is the only library we're using that has been built with source maps.

Anyway, as you say, it's not an issue, it's more of an annoyance to anyone who happens to be looking at the dev tools. So whether it's worth the effort of fixing is, IMHO, highly questionable!
Comment 3 Jonathan Druart 2021-02-09 15:22:14 UTC
I get bug 26471 on Firefox as well. I attached a patch there.
Why not simply remove the line?
Comment 4 Katrin Fischer 2023-01-23 22:33:52 UTC
> The options for addressing the error:
> 
> 1. Don't address the error. It only appears if you are inspecting the source
> in Chrome dev tools.
> 
> 2. Modify each minified JavaScript file we get from third-party sources
> which include sourceMappingURL.
> 
> 3. Build our own minified JavaScript files for each JS library and include
> the option to generate source maps.
> 
> My vote is #1, and WONTFIX.

... and Owen is (almost) always right. Closing this one, see explanation in comment #1