my html document's head tag has in it:
<script src="/packs/vendors-node_modules_jquery_dist_jquery_js-exposed-e9b29cc0e77d15c93346.js" defer="defer"></script>
and in the document's body, I have a script tag which is trying to use jQuery, but I get the error that $ is undefined.
How can I make it so that expose-loader does not put that defer tag on jQuery so that it's available when my script tag is executed?
I faced the same problem and finally solved it by installing html-webpack-plugin and adding a custom-webpack.config.js file with the following configuration:
new HtmlWebpackPlugin({
...
scriptLoading: 'blocking',
}),
This config removed the defer="defer" from my scripts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With