Webpacker load error (Uncaught TypeError: $(...).metisMenu is not a function)

1.1k Views Asked by At

Trying to get a (what should be) simple module to work: metisMenu

However, unfortunately I'm failing in doing so, apparently something in my Webpacker setup because when loading my page I get the error: Uncaught TypeError: $(...).metisMenu is not a function

There is an issue in loading the module in application.js. The module is being loaded in vendor/assets/javascripts/app.js

  • I have jQuery correctly installed
  • the following snippet into the head section makes it work (but this is without the use of Webpaker):
  <script src="https://cdn.jsdelivr.net/npm/jquery"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
  <script src="https://unpkg.com/metismenu"></script>

. I've created a github branch. Please help! https://github.com/henkjanwils/metisMenu-error

0

There are 0 best solutions below