3

Background

Drupal core contains some 3rd party javascript libraries, among them jQuery. Typically such libraries are available as un-minified and minified versions. A minified js file can have a reference to a source map via sourceMappingURL, which can be used by the browser developer tools to show the original source.

Since https://www.drupal.org/project/drupal/issues/1341792, js files like jQuery are shipped as a minified version.

In https://www.drupal.org/project/devel/issues/2471919, it was considered to add an option in devel to send the un-minified version instead. This was discarded because we can use source maps.

The minified jQuery.min.js used to have a sourceMappingURL reference, but this is gone in newer versions.

I also found some issues talking about warnings and errors from files with sourceMappingURL, if the referenced source map is missing. But I don't know if these are related.

Problem

There seems to be no way (besides hackery) to see the original js file (e.g. original jQuery.js) for debugging in the browser.

EDIT: The browser can prettify the js, but it cannot un-minify the variable names or restore comments. So I do not consider this a sufficient solution. I should have mentioned this directly.

Question

Am I missing something? Is there a hidden option or contrib solution to make the source maps work, or to use the un-minified jquery.js for debugging during development?

(depending on the answer, I might open an issue on drupal.org)

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.