1、npm 安装jquery
npminstall jquery --save
2、build/webpack.base.conf.js
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
jQuery:"jquery",
$:"jquery"
})]
3、main.js 中引入jquery
import $ from 'jquery'
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
jQuery:"jquery",
$:"jquery"
})]
import $ from 'jquery'