方法一:

一,在package.json里加入,

dependencies:{
  ”jquery“:”^2.3.4“  
}

二,在webpack.base.conf.js里加入

const webpack = require(”webpack“)

三,module.exports最后

  plugins:[
    new webpack.optimize.CommonsChunkPlugin('common.js'),
    new webpack.ProvidePlugin({
      jQuery: "jquery",
      $: "jquery"
    })
  ]

四,npm install 下载jquery

npm install jquery

五,main.js引入

import $ from 'jquery'

最后npm run 一下自己的项目

 

相关文章:

  • 2021-11-02
  • 2021-11-02
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案