how to include jquery in webpack?

0

I do not know how to do it and I already followed several explanations that I found on the web and none of them work for me. I'm using vue-cli that works with webpack .

try this:

plugins:[
  new webpack.ProvidePlugin({
    jQuery: 'jquery',
    $: 'jquery',
    jquery: 'jquery'
  })
]'

Try the import $ from 'jquery'

I got that error.

    
asked by Wilberth Loría 28.03.2017 в 20:36
source

1 answer

1

Alternative 1

You can import jQuery directly into the component that you need it, you just have to install the library with npm or yarn

$ npm install --save jQuery
$ yarn add jQuery

You just have to do the following in your component.

import $ from 'jquery'

Alternative 2

You can import the library directly into your índex.html file, as you would commonly do.

<script src="https://unpkg.com/jquery"></script>
    
answered by 28.03.2017 / 21:36
source