0

I got this error when I tried to add a jquery library.

{
   test: require("path").resolve("./main/static/src/application.js"),
   loader: 'imports-loader?this=>window,$=jquery!./main/static/src/vendor/jquery-ui/ui/widgets/draggable.js'
}

new webpack.ProvidePlugin({
    $: "jquery",
    jQuery: "jquery",
    'window.jQuery': 'jquery',
    'window.$': 'jquery',
    io: 'socket.io-client',
    _:'underscore',
    moment:"moment",
})

ERROR:

ERROR in jQuery is not defined
4

1 回答 1

0

看起来有几种方法可以解决这个问题,我选择了expose-loader

{
  test: require.resolve('jquery'),
  use: [
   'expose-loader?jQuery',
   'expose-loader?$'
  ]
},

查看更多详细信息。

于 2018-02-08T02:51:05.247 回答