'jquery is not defined' when using webpack to load bootstrap

后端 未结 4 1370
故里飘歌
故里飘歌 2020-12-14 06:34

I am just starting to learn to use Webpack (previously I just use the manual way to include individual scripts separately). And I used bootstrap-loader for load

4条回答
  •  無奈伤痛
    2020-12-14 07:05

    Add this as plugin

      new webpack.ProvidePlugin({
       $: "jquery",
       jQuery: "jquery"
      })
    

    and you should be able to have jquery in your whole project.

    If issue persists after adding the plugin, try restarting your nodejs server. Remember to install jquery using npm install --save jquery.

提交回复
热议问题