Hello,
I want to use owl carousel in my gatsby project.
I am using https://www.npmjs.com/package/react-owl-carousel this library .
But can not configure the settings.
Also can not understand where should I place the webpack configuration.
Any help is much appreciated.
Thanks.
Is that you need to use jQuery with react-owl-carousel ?
Because the documentation also mention you can use html script tag to inject jquery as well.
Here is how you can customize html in gatsby:
https://www.gatsbyjs.org/docs/custom-html/
Also here if you want to customize webpack:
https://www.gatsbyjs.org/docs/add-custom-webpack-config/
This solution works for me.
Thanks @duongthienlee for the resource.
exports.onCreateWebpackConfig = ({
stage,
rules,
loaders,
plugins,
actions,
}) => {
actions.setWebpackConfig({
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
],
})
}
Thanks.
Issue seems resolved, so I'll close it.
@anamwp can you show the import for the webpack namespace?
Most helpful comment
Is that you need to use jQuery with react-owl-carousel ?
Because the documentation also mention you can use html script tag to inject jquery as well.
Here is how you can customize html in gatsby:
https://www.gatsbyjs.org/docs/custom-html/
Also here if you want to customize webpack:
https://www.gatsbyjs.org/docs/add-custom-webpack-config/