require js jquery plugins

2019-06-23 02:13发布

问题:

Do I have to write wrappers for each jQuery plugin I am trying to use in require.js? I can't user the order plugin they still give me the error that they depend on jQuery.

Thanks

回答1:

RequireJS 2.0 has a shim option that allows you to use older non-AMD scripts as modules - http://requirejs.org/docs/api.html#config-shim



回答2:

Have you read How to use require js with jquery? It explains that you can use require js to load jquery and jquery plugins by using a combined jquery/requirejs file. You can find a sample project here. There are also several alternative strategies listed in the sample project's readme.