npm browserify version of jquery-select2 version 4.x

孤街醉人 提交于 2019-12-11 04:26:01

问题


I was wondering if :

  1. There is a browserif'ied version of jquery-select2 4.x plugin available via npm?
  2. If not, what do I need to do in order to get jquery-select2 4.x to work with my npm/browserify based project?

I was looking at the source on github and it seems like there is a require/almond.js version available. Can the same version be used with browserify without any changes?

I'm slightly confused as to what exactly am I required to do if I want to use jquery-select2 plugin with my project that uses npm and browserify?

Thanks in advance.


回答1:


There seems to be an issue in select2-4.0.0 when used in node/browserify environment. Until this issue is resolved you can depend on the issue creator's fork where it seems solved by pulling in {"select2": "leftmostcat/select2"} (instead of select2/select2) as dependency from within your package.json.




回答2:


As of today, you can simply load the latest version of Select2 at https://www.npmjs.com/package/select2.

Just install it by using npm install select2




回答3:


I had that problem too. I solved that by adding the plugin with a script-tag to the page.

There ist no npm module for that plugin. There is only ember-select-2, a wrapper for jQuery select 2, but i don't know, if it ist the same. Just try it. But my above solution schuld work anyway.



来源:https://stackoverflow.com/questions/29638091/npm-browserify-version-of-jquery-select2-version-4-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!