Owl carousel not working in vite - cannot read property of undefined (reading 'fn')

Viewed 842

I updated my dev environment for vite. It's all working fine except an old jQuery plugin, owl.slider. I get that error:

owl.carousel.js:1718 Uncaught TypeError: Cannot read properties of undefined (reading 'fn')
at owl.carousel.js:1718
at node_modules/owl.carousel/dist/owl.carousel.js (owl.carousel.js:1753)
at __require2 (chunk-IYHMIRNV.js?v=bf03b4af:5)
at dep:owl_carousel:1

When using webpack I had the same but got it fixed with the ProvidPlugin

new webpack.ProvidePlugin({
  $: "jquery",
  jQuery: "jquery",
  "window.jQuery": "jquery",
}),

Is there something similar for vite or is there something I am missing?

0 Answers
Related