When I load pages on our live site (D9), we see these Modernizr errors from contextual links JS, and the contextual links don't appear on the site.

Chrome JS Console output

However, Modernizr does appear to be loaded ahead of the contextual links JS, as you can see from the two further screen captures, so I don't see why RegionView and VisualView should think it is undefined.

Modernizr load time Region View load time

and also the Modernizr object is available in the JS console after page load

Modernizr object in console

I have no idea how to progress solving this. To make things worse, this doesn't seem to happen on our test sites, which are running on the same codebase.

  • Are the scripts loaded async? If so the order you’re seeing might be request start, not request end
    – Clive
    Apr 12, 2022 at 11:52
  • Thank you for the suggestion Clive. I don't believe they are loaded async from looking at the HTML, plus my understanding (which might be wrong, I am no expert in this) is that the Timing panel in the screen grabs shows that modernizr request was completed before the RegionView request started? Apr 12, 2022 at 12:33
  • 1
    It says Started at 1.73 s and Started at 3.16 s, which means that RegionView.js was received after receiving modernizr.js. It seems they are asynchronous calls since they are queued at 1.63 s and 1.68 s.
    – apaderno
    Apr 12, 2022 at 16:15
  • Thank you Apaderno, does that mean modernizr would have been loaded by the time RegionView attempted to reference it, or might there be other reasons why it wasn't? Apr 12, 2022 at 16:23
  • That depends from what the code does after asynchronously loading the files. If it waits for the files to be loaded, it should not say that Modernizr isn't defined.
    – apaderno
    Apr 12, 2022 at 16:34


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.