1

I am pretty confused on how to make the Javascript utilities in Bootstrap 4 work.

I am using ES2015 style requires. I've installed jQuery, the latest beta of Bootstrap 4 (beta 2) and Popper.js using node modules. Here's how I am loading my JS:

window.$ = window.jQuery = require('jquery');

$(function() {

  require('popper');
  require('./vendor/bootstrap/index');

});

Popper's docs state that you need code like this to instantiate Popper:

  var reference = document.querySelector('#dropdownLanguageButton');
  var popper = document.querySelector('div[aria-labelledby="dropdownLanguageButton"]');
  var anotherPopper = new Popper(
      reference,
      popper,
      {
          // popper options here
      }
  );

However, it is not clear if you need to instantiate for something as simple as a Bootstrap dropdown.

There is no clear example in the Bootstrap 4 docs.

The error I am getting is index.js:10 Uncaught ReferenceError: Popper is not defined.

Help appreciated!

Melchia
  • 22,578
  • 22
  • 103
  • 117
Wolfr
  • 5,055
  • 4
  • 25
  • 31

1 Answers1

-1

Maybe problem in path to popper.js. Popper's required file located in 'node_modules/popper.js/dist/umd/popper.min.js'

makenti
  • 1
  • 1