- Issue created by @ciesinsg
- 🇨🇦Canada ciesinsg
After further investigation, I noticed that the underscore-min.js file that is listed as a dependency for Backround Image does not load for anonymous users (only loads for authenticated users).
In the core.libraries.yml file, it states that this is an internal library and should not be used outside of core or to add new core usage as it is expected to be removed when the listed issues are fixed:
internal.underscore: # Internal library. Do not depend on it outside core nor add new core usage. # The library will be removed as soon as the following issues are fixed: # - https://www.drupal.org/project/drupal/issues/3270395 # - https://www.drupal.org/project/drupal/issues/3203920 # - https://www.drupal.org/project/drupal/issues/3204011 # - https://www.drupal.org/project/drupal/issues/3204015 remote: https://github.com/jashkenas/underscore version: "1.13.6" license: name: MIT url: https://raw.githubusercontent.com/jashkenas/underscore/1.13.6/LICENSE gpl-compatible: true js: assets/vendor/underscore/underscore-min.js: { weight: -20, minified: true }
This concerns me as the whole module may break in the future if underscore is removed from core.
I am still looking into how to get this dependency to load properly for Anonymous users, but any assistance or advice would be greatly appreciated.
- 🇨🇦Canada ciesinsg
As this bug affects Anonymous users accessing the site and is caused by a depracated/removed dependency issue, I changed the priority to major as per the Issue Priority → documentation.
- 🇧🇪Belgium jbfelix
As workaround i added this in the head section of html.html.twig template in my subtheme:
{% if logged_in %} {% else %} <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.7/underscore-min.js"></script> {% endif %}
Maybe not clean but it's working...