How to make a jQuery plugin loadable with requirejs

后端 未结 3 1257
迷失自我
迷失自我 2020-12-07 07:21

I\'m working with requirejs+jquery and i was wondering if there was a smart way to make a jQuery plugin work well with require.

For example i\'m using jQuery-cookie.

3条回答
  •  醉话见心
    2020-12-07 07:49

    Just as an FYI to all some of the jquery plugins already use amd/require so you dont need to declare anything in the shim. In fact doing so might cause problems for you in some cases.

    If you look in the jquery cookie JS you will see define calls and require(["jquery"]).

    and in jquery.js you will see a call to define("jquery",[],function()...

提交回复
热议问题