Including JQuery Mobile in a Node JS project with Browserify

后端 未结 4 607
面向向阳花
面向向阳花 2021-01-12 14:59

I\'m writing a Node JS application where I need both jQuery UI and jQuery Mobile. I\'m using Browserify to pack the modules in a single js file.

I have the following

4条回答
  •  逝去的感伤
    2021-01-12 15:38

    You must use a browserify shim.

    You could use grunt-browserify to run your requires before page load.

    Then you can simply use a shim to export '$' and require jQuery in JQuery.mobile like its done here with another plugin :

    Shim a jQuery plugin with browserify

    You could also use https://github.com/thlorenz/browserify-shim if you do not like the grunt approach

提交回复
热议问题