gatsbyjs/gatsby-source-wordpress-experimental

How to include jQuery via webpack plugin

Closed this issue · 1 comments

Hello,

I was trying to add react-owl-carousel plugin, to the Gatsby Wordpress site I am working on. I am adding jquery by including the following code in the gatsby-node.js, as per the instructions here: https://github.com/laurenchen0631/react-owl-carousel

However it says "TypeError: $ is undefined"

const jquery = require(jquery) exports.onCreateWebpackConfig = ({ stage, rules, loaders, plugins, actions }) => { actions.setWebpackConfig({ plugins: [ new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery' }), ] }); };

Any idea how to fix this?

Fixed this by just inserting a script tag in my index.html.