jQuery not define in bootstrap module

前端 未结 1 693
不知归路
不知归路 2021-02-02 08:46

I want to use bootstrap for my website (with node.js). But I have the following error :

/var/www/node_modules/bootstrap/js/transition.js:59 }(jQuery);

1条回答
  •  盖世英雄少女心
    2021-02-02 09:08

    To use jquery plugins with npm/node you need to set the global jQuery variable before requiring your plugin [bootstrap in this case]:

    global.jQuery = require('jquery');
    require('bootstrap');
    

    More details in this npm blog post

    0 讨论(0)
提交回复
热议问题