I've got jQuery being imported twice (same version), and I think this is the reason why I'm getting a few other front-end errors.
On any particular page, one scriptresource is being loaded in the <head> and one in the <body>
on my default.cshtml file, I've referenced using: @Html.Script(ScriptRef.JQuery, "head")
I've noticed that a lot of custom MVC modules are also referencing jQuery using: @Html.Script(ScriptRef.JQuery, "top", true) or @Html.Script(ScriptRef.JQuery, "top", false)
Pardon my ignorance, but surely just keeping the reference in the Head in my default.cshtml should be enough?Would commentingout/deleting the top references in all of my widgets be enough?
Currently we check for duplicating scripts only in the scope of one section. Therefore if you add the same script in two different sections it will be loaded twice.
Based on this I can suggest you change the reference inside the default.cshtml file to be in section “top”. Otherwise you will need to go through all the templates of widgets that you use and change the name of the jQuery section for them to “head”, however this is not a recommended approach. Also, as you can see in the default.cshtml file, we define the section named “top“ in the beginning of the body tag, so if you place the jQuery there, it will still be loaded before anything else.
Still, if you are set to reference the jQuery in the head, you can try to move the definition of the top section (@Html.Section("top")) in the head tag. If you choose this approach, please have in mind that this is significant change in the script behavior and could cause issues in some of the default widgets.