drgullin / icheck

Highly customizable checkboxes and radio buttons (jQuery & Zepto)
http://fronteed.com/iCheck
7.39k stars 1.63k forks source link

Make a compatible with Webpack Frameworks #414

Closed lucasmpaim closed 3 years ago

lucasmpaim commented 5 years ago

This PR resolves the issue #387 and #390

The jQuery on my project has imported with:

  window.$ = require('jquery')
  window.JQuery = require('jquery')

But this causes a error in library, because $ is undefined, this PR resolves it.

For use the library with webpack is something like:

require('icheck/icheck');
window.$('input').iCheck({
      ....
});
lucasmpaim commented 5 years ago

Another way is add this to webpack and expose the jQuery:

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