1. 在package.json中的dependences中引入jquery的版本
2.第二步在webpack.base.conf.js文件中加入如下内容:
const webpack = require("webpack")
![](https://img2020.cnblogs.com/blog/1324629/202008/1324629-20200826095057101-1543753815.png)
'jquery': 'jquery'
plugins:[
new webpack.ProvidePlugin({
$:'jquery',
jQuery: 'jquery'
})
]
![](https://img2020.cnblogs.com/blog/1324629/202008/1324629-20200826095133287-1649148973.png)
3.第三步:安装 npm install jquery --save
4.在需要用到的地方引入jquery
import $ from 'jquery'