search

Home  >  Q&A  >  body text

javascript - How to introduce jquery with vue+webpack

How to introduce jquery into vue webpack?

滿天的星座滿天的星座2737 days ago572

reply all(5)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:27:43

    Just introduce cdn directly into index.html. No need to go to such trouble.

    reply
    0
  • 阿神

    阿神2017-05-19 10:27:43

    import $ from 'jquery'
    首先 cnpm i --save jquery

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-19 10:27:43

    1. npm i jquery --save import $ from jquery This will put jquery into the final generated bundle

    2. index.html引入,import $ from 'jquery', webpack 的配置项external里面加上 'jquery': 'jQuery' He will look for jquery from the overall perspective.

    reply
    0
  • 迷茫

    迷茫2017-05-19 10:27:43

    wabpack introduces jquery

    reply
    0
  • 高洛峰

    高洛峰2017-05-19 10:27:43

    1.npm i jquery --save (you will still depend on jquery after publishing)
    2. In the entry file main.js (depending on the entry file you configured), introduce import $ from 'jquery'

    reply
    0
  • Cancelreply