Search code examples
carouselmaterializewebpack-2

Use carousel of materialize via webpack 2


I´m traying use the carusel of materialize via webpack but I get this error:

Uncaught TypeError: $(...).carousel is not a function

I´m using:

"webpack": "^2.2.1"
"jquery": "^3.2.0",
"materialize-css": "^0.98.0"

And in my js file:

$(document).ready(function(){
   $('.carousel').carousel();
});

I heve checked jquery and css materialize and work fine.


Solution

  • As of today, jQuery v3 is not fully compatible with materialize. A PR is open : https://github.com/Dogfalo/materialize/pull/4587

    Meanwhile, you can change the jQuery in your package.json to match the version used by materialize "jquery": "^2.1.4".