Managing jQuery plugin dependency in webpack

前端 未结 11 1514
陌清茗
陌清茗 2020-11-22 01:17

I\'m using Webpack in my application, in which I create two entry points - bundle.js for all my JavaScript files/codes, and vendors.js for all libraries like jQuery and Reac

11条回答
  •  [愿得一人]
    2020-11-22 01:31

    I tried some of the supplied answers but none of them seemed to work. Then I tried this:

    new webpack.ProvidePlugin({
        'window.jQuery'    : 'jquery',
        'window.$'         : 'jquery',
        'jQuery'           : 'jquery',
        '$'                : 'jquery'
    });
    

    Seems to work no matter which version I'm using

提交回复
热议问题