Webpack using bootstrap - jquery is not defined

前端 未结 7 1444
轮回少年
轮回少年 2020-11-29 00:20
import $ from \'jquery\';
require(\"./node_modules/bootstrap/dist/css/bootstrap.min.css\")
require(\"./node_modules/bootstrap/js/dropdown.js\")
import React from \'r         


        
7条回答
  •  春和景丽
    2020-11-29 00:51

    In order for this code to work you must RESTART Node after the change:

    // webpack.config.js
    module.exports = {
        ...
        plugins: [
            new webpack.ProvidePlugin({
               $: "jquery",
               jQuery: "jquery"
           })
        ]
    };
    

提交回复
热议问题