Skip to content

Instantly share code, notes, and snippets.

@mucavel
Forked from ansidev/nuxt.config.js
Created October 14, 2024 14:39
Show Gist options
  • Save mucavel/cbf4ba2aaf42b6a14ffc0634bbff928a to your computer and use it in GitHub Desktop.
Save mucavel/cbf4ba2aaf42b6a14ffc0634bbff928a to your computer and use it in GitHub Desktop.
Use jQuery with NuxtJS
const webpack = require('webpack')
module.exports = {
// other configs
build: {
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
]
},
// other configs
}
{
// other configs.
"dependencies": {
// Replace <jquery.version> with the jquery version you want.
"jquery": "<jquery.version>"
},
// other configs.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment