Browserify with twitter bootstrap

前端 未结 4 1522
萌比男神i
萌比男神i 2020-12-22 21:32

There are many similar questions including answers here on stack overflow, but none of them have worked for me, so here I am asking you guys. I appreciate everyone\'s time.

4条回答
  •  孤城傲影
    2020-12-22 21:39

    I've been wondering about this for a while. This simple solution does the job for me:

    import foo from 'foo';
    import bar from './bar';
    import { default as $ } from "jquery";
    global.$ = $;
    global.jQuery = $; // This one does the trick for bootstrap!
    // Boostrap's jQuery dependency only works with require, not with ES6 import!
    const btp = require('bootstrap');
    

提交回复
热议问题