Error using Bootstrap & jQuery Packages in ES6 with Browserify

后端 未结 4 1967
滥情空心
滥情空心 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:52

    I've tried many many solutions but for some reason I had to define the global jquery in lowercase on the base script (eg. main.js)

    import jQuery from 'jquery'
    global.jQuery = jQuery
    global.jquery = jQuery // jquery lowercase was the solution for me
    global.$ = jQuery
    let Bootstrap = require('bootstrap')
    import 'bootstrap/dist/css/bootstrap.css'
    

    This solutions also works for vue-cli + jquery + bootstrap

提交回复
热议问题