woocommerce / FlexSlider

An awesome, fully responsive jQuery slider plugin
http://www.woocommerce.com/flexslider/
GNU General Public License v2.0
4.91k stars 1.69k forks source link

Typeerror: $(...).flexslider() is not function - Using webpack. #1693

Closed code-mattclaffey closed 6 years ago

code-mattclaffey commented 6 years ago

Hey I am getting an issue when I move my plugins into a vendor file with webpack.

vendor: ['jquery', 'slick-carousel', 'flexslider', 'imagesLoaded', 'masonry-layout', 'lazysizes', 'picturefill']

I know flexslider requires jQuery to run so maybe thats the issue however I have defined jQuery as a global with the ProvidePlugin module. I have tried to add flexslider in the plugin but still no luck.

As a temp fix I have just required the plugin at the top of my common.bundle.js file however I want flexslider to be with the other plugins.

Has anyone come across this issue using flexslider before?

Flexslider 2.6.0 Webpack 3.8.0

code-mattclaffey commented 6 years ago

Fix is to set jQuery to be global like so:

window.$ = $;
window.jQuery = $;

Answer is here: https://stackoverflow.com/a/30331983/3737753