You have just loaded your website, and something is now working right. Upon checking the Console, you see the following error:
jQuery is not defined
The error means that a script that requires jQuery to function properly has been executed, but due to the optimization or other exclusions that you have, the jQuery library was not yet loaded when that initial script runs and therefore triggers an error.
Check if NitroPack is the culprit for the “jquery is not defined” error
Load your page while bypassing the NitroPack cache; this can be done by adding /?nonitro to the URL (e.g., example.org/?nonitro).
You should then check if the error is present on the non-optimized version of your page as well.
⚠️If the error is present, this means that NitroPack is not the cause, and you should check your website code or consult with a Developer.
The error is not present on the unoptimized page
If the error is present only when NitroPack is active on the page, you shouldn’t worry.
✅Here’s an easy way to fix the “jquery is not defined” error by yourself.
What you need to do is exclude the jQuery library from optimization.
To do so, head over to NitroPack’s Dashboard → Settings → General → Excluded Resources.
Add the following exclusion:
- Asset URL/Code:
- Resource Type:
And leave the rest as it is.
ℹ️The asterisks are needed for NitroPack to catch all of the files containing that common string.
💡We then recommend doing a full cache purge so that NitroPack can create the new optimizations where the issue should no longer be present.
You can do this via the NitroPack’s Dashboard > Cache status tab.
📌 If you need any assistance or have questions, you can always reach out to our support team at firstname.lastname@example.org or via this link: https://support.nitropack.io/hc/en-us/requests/new
Please sign in to leave a comment.