Error using Bootstrap & jQuery Packages in ES6 with Browserify

后端 未结 4 1963
滥情空心
滥情空心 2021-02-07 18:16

I\'m trying to use Bootstrap with jQuery. I\'m using Browserify with a Babel transform to compile. I get the following error.

Uncaught ReferenceError: jQuery is          


        
4条回答
  •  梦谈多话
    2021-02-07 18:47

    As mentioned by Pete TNT, there is a bug in the Bootstrap package I am using. I switched to using this Bootstrap package and made the following changes to my code.

    window.$ = window.jQuery = require('jquery');
    var Bootstrap = require('bootstrap-sass');
    Bootstrap.$ = $;
    require('../../../../../node_modules/bootstrap-sass/assets/javascripts/bootstrap');
    

    It looks like, for the time-being, ES6 imports will not work with jquery and bootstrap packages in the way I was trying to use them.

提交回复
热议问题