jquery-modal icon indicating copy to clipboard operation
jquery-modal copied to clipboard

Missing 'jquery' dependencies in package.json

Open fantasydr opened this issue 6 years ago • 0 comments

Thanks for the awesome modal implementation.

This issue is caused by #162

In the end of the article referenced in #162 , https://blog.npmjs.org/post/112712169830/making-your-jquery-plugin-work-better-with-npm , the author said something important which was not included in the PR.

Note: because you are using `require` to pull in jQuery here, 
you’ll need to add it as a dependency in `package.json`:
"dependencies": {
  "jquery": "^2.1.3"
}

Personally I think the dependency and CommonJS code is not necessary. The nodejs user could always add window.jQuery = window.$ = require('jquery'); to their project for compatibility. But adding the CommonJS code will preventing the nodejs user using a shared jQuery instance.

Is it better to add a dependency or just remove the CommonJS code, and let user manually bind their jquery instance to the global variable ('jQuery, or $')? Or check the existence of global jQuery before require('jquery').

I don't know which one is better, but current scenario seems not right anyway: the dependency is empty but the code require 'jquery' internally.

fantasydr avatar May 03 '19 09:05 fantasydr