3

I have couple of third-party libraries which depends on jquery version 1.8.3 whereas certain scripts require version 2.0+. How can I include multiple versions of jquery in webpack or in index.html file.

Currently i've used jquery plugin:

plugins: [
    new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        "window.jQuery": "jquery"
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ],
Rahul Dagli
  • 4,301
  • 15
  • 47
  • 85

1 Answers1

0

npm does not support diffent versions of the same module to be installed.

When you're configuring ProvidePlugin as you are, you're saying that the variables $, jquery and window.jQuery are equal to require('jquery'). So, you can't have two different versions like that.

If you really need to have two different versions of jQuery, you could try the solution proposed on this answer.

Can I use multiple versions of jQuery on the same page?

thitemple
  • 5,833
  • 4
  • 42
  • 67