1. Install jQuery dependencies
npm install jquery --save-dev
2. Add the following code to the header of webpack.base.conf.js
var webpack = require("webpack")
3. Add the following code at the end of module.exports
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
jQuery: "jquery",
$: "jquery"
})
]
4. Finally, introduce it globally in the entry file main.js (it can also be introduced in the component as needed)
import $ from 'jquery'
After that,
restart the project
~ and then you can happily use jQuery in other components...