Antwerp-based teacher at the Karel de Grote University of Applied Sciences and Arts. Avid programmer at the backend, frontend, and everything in between.
Location
Antwerp, Belgium
Work
Lecturer at KdG University of Applied Sciences and Arts
Hey, thanks for your comment! You won't be able to use jQuery in a script section using this setup. You can use jQuery in a JavaScript file that will be picked up by webpack, however.
If you do need jQuery in an inline JavaScript section, then I'd recommend adding reference to a jQuery CDN as well.
Hope this helps your refactoring. Good luck!!
Thank You for Your answer.
I did find another solution. I can use expose-loader to make it work.
{
test: require.resolve("jquery"),
loader: "expose-loader",
options: {
exposes: ["$", "jQuery"],
},
},
Antwerp-based teacher at the Karel de Grote University of Applied Sciences and Arts. Avid programmer at the backend, frontend, and everything in between.
Location
Antwerp, Belgium
Work
Lecturer at KdG University of Applied Sciences and Arts
Hey, thanks for your comment! You won't be able to use jQuery in a script section using this setup. You can use jQuery in a JavaScript file that will be picked up by webpack, however.
If you do need jQuery in an inline JavaScript section, then I'd recommend adding reference to a jQuery CDN as well.
Hope this helps your refactoring. Good luck!!
Thank You for Your answer.
I did find another solution. I can use expose-loader to make it work.
{
test: require.resolve("jquery"),
loader: "expose-loader",
options: {
exposes: ["$", "jQuery"],
},
},
Great! That looks like an ideal solution. Thanks for the addition!