[Pkg-javascript-devel] Bug#922824: Bug#922824: sourceMappingURL in minified js seems to point to the wrong location

Jonas Smedegaard jonas at jones.dk
Thu Feb 21 10:05:00 GMT 2019


Hi Enrico,

Thanks for reporting this issue!


Quoting Enrico Zini (2019-02-21 09:31:42)
> The minified bootstrap4 javascript file is currently distributed in
> these two paths:
> 
>   /usr/lib/nodejs/bootstrap/dist/js/bootstrap.min.js
>   /usr/share/javascript/bootstrap4/js/bootstrap.min.js
> 
> and they come with a sourceMappingURL of:
> 
>   //# sourceMappingURL=dist/js/bootstrap.js.map
> 
> If I make one of those paths accessible on the web and include bootstrap
> with something like:
> 
>   <script src="{{static_url('bootstrap4/js/bootstrap.min.js')}}"></script>
> 
> Then I see the browser make this failed request on my HTTP server:
> 
>   404 GET /static/bootstrap4/js/dist/js/bootstrap.js.map
> 
> I tried to look up how sourceMappingURL works:
> 
>   https://stackoverflow.com/questions/38427991/which-is-the-base-url-of-sourcemappingurl-relative-from-html-or-js
> 
> and it looks to me like bootstrap.min.js should contain something like
> "sourceMappingURL=bootstrap.js.map" to have it being found alongside the
> .min.js version.

My understanding is that the source-mapping should point to _source_ 
locations.

For simple cases, we provide source in node-* packages and minified code 
in libjs-* packages, but not always: Nodejs code may be reorganized, 
concatenated and/or transformed code as well.

I believe source-mapping files in Debian should follow same structure 
across all Javascript packages in Debian, and that we therefore cannot 
rely on mapping to Nodejs code (even if possibly it might be possible to 
do for Bootstrap specifically).

My intend (untested, undocumented and uncoordinated with the Javascript 
team - thanks for pulling it out of me now for the first time ever) for 
these source-mapping files recently added to Bootstrap and 10-30 other 
packages, is that the source-mapping files map to the files relative to 
corresponding Debian source packages.

Using source-maps for browsing into sources requires somehow serving 
those source files, and hinting e.g. with the "SourceMap" http header 
where they are located.

I imagine it would be possible to setup a static Apache2 hint to point 
to the sources served at https://sources.debian.org/


Does that make sense?  If so, then I believe this "bug" is more lack of 
documentation than the Boostrap package being wrong.


Thanks a lot for your interest in these details, and sorry this was not 
already in a more polished state,

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20190221/22b0ef98/attachment.sig>


More information about the Pkg-javascript-devel mailing list