0👍
✅
If you’re using webpack
. There is another method to includes jQuery as global variable using ProvidePlugin
. You can add to your webpack.base.conf.js
module.exports = {
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
'window.jQuery': 'jquery',
jQuery: 'jquery'
})
]
}
If you’re using Eslint, you need to add to .eslintrc.js
module.exports = {
globals: {
"$": true,
"jQuery": true
},
...
Source:stackexchange.com