A
A
Alexander Lyamin2018-09-05 15:11:29
JavaScript
Alexander Lyamin, 2018-09-05 15:11:29

Why does webpack build see jQuery plugins selectively?

I am using the webpack assembly for the first time on the project and during this time I often had the idea to stop doing it. The topic of webpack and jQuery plugins has been more than covered, but what if js sees plugins selectively after assembly?

webpack.config.js:

plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery/dist/jquery.min.js',
      jQuery: 'jquery/dist/jquery.min.js',
      'window.jQuery': 'jquery/dist/jquery.min.js',
      'window.$': 'jquery',
    })
  ]


main.js:
import './vendor/fancybox-master/dist/jquery.fancybox.min.js';
import './vendor/slick/slick/slick.js';


Fancybox works great from a script, but Slick doesn't (is not a function).

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question