Fix drupal 8 javascript theme error: ReferenceError: Drupal is not defined.

This error occurs when you add custom javascript to your theme. Add the following dependencies to your theme.libraries.yaml file to fix it. 

NAMEOFMYLIBRARY:
  js:
    js/MYJS.js: {}
  css:
    component:
      css/MYCSS.css: {}
  dependencies:
    - core/jquery
    - core/drupal

 

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!