1. 找到webpack.config.js文件
2. 在module.exports中的plugins添加一段代码
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'manifest']
}),
new HtmlWebpackPlugin({
template: 'src/index.html'
}),
new webpack.ProvidePlugin({
jQuery: "jquery",
$: "jquery"
})
]
3.重启项目后还是不可以需要在终端输入: npm install jquery --save ,执行下就可以了