Problem/Motivation

The Google CSE search can fail to work when very few JS files are loaded for anonymous users, because the drupal.js file is never loaded on the page and the JS console reports "Undefined variable Drupal".

Steps to reproduce

...

Proposed resolution

Add the full set of dependencies to google_cse.libraries.yml

The libraries are currently specified as:

googlecseResults:
  css:
    theme:
      css/google_cse.css: {}
  js:
    js/google_cse_results.js: {}
  dependencies:
    - core/drupalSettings

But the following also need to be added as dpenedencies, since they are also used in the google_cse.js file:

    - core/jquery
    - core/drupal

Issue fork google_cse-3210785

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

quicksketch created an issue. See original summary.

lreynaga’s picture

Thanks for reporting this and creating the MR.

I've never encountered this before given we probably load these libraries somewhere prior, but as you've mentioned, it makes sense to have these dependencies specified within the libraries file.

  • lreynaga committed 89426f4 on 8.x-3.x authored by quicksketch
    Issue #3210785 by quicksketch: Not all dependencies are declared in...
lreynaga’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.