Why I am getting this error "drupal.js?v=8.5.0:13 Uncaught TypeError: a.indexOf is not a function" when I uncomment js/build/scripts.js in my libraries.yml file? By the way, I am using Grunt and I followed all the instructions in readme file but for some reason it throwing me an error.

Comments

denisomerovic created an issue. See original summary.

leahtard’s picture

Are you also uncommenting the dependancies as per the note below?

global:
  version: VERSION
  css:
    base:
      css/base/base.css: {}
    layout:
      css/layout/layout.css: {}
    component:
      css/components/components.css: {}
    theme:
      css/theme/theme.css: {}
      css/theme/print.css: { media: print }
  js:
    js/modernizr.js: {}
  #   js/build/scripts.js: {}
  # dependencies:
  #   - core/drupal
  #   - core/jquery

  # Uncomment the code above to load scripts.js file on all pages. This file also requires JQuery to be
  # loaded on all pages. Consider implimenting your scripts through theme libraries if you wish to
  # avoid this. https://www.drupal.org/developing/api/8/assets
leahtard’s picture

Status: Active » Postponed (maintainer needs more info)
drupalchille’s picture

Yes, I did. I guess Grunt caused the problems, npm install solved everything. But still, if someone decides to not use grunt I guess Error will be there. The error disappears once I did npm install.

leahtard’s picture

Ok, yes. That makes sense. We should add some additional documentation in the README and in the note under the global library. If you would like to submit a patch for this, please do!

Cheers, Leah

leahtard’s picture

Status: Postponed (maintainer needs more info) » Needs work
awasson’s picture

Status: Needs work » Closed (outdated)
Issue tags: -

I'm closing all of the old and outdated issues. This one appears to be an edge case which isn't relevant for version 3.0.

Cheers,
Andrew