Stephen Stephen - 9 months ago 62
jQuery Question

.net mvc Updated jquery now getting critical error

I updated jquery today through NuGet and I am now receiving the following error:

JavaScript critical error at line 1, column 11 http://localhost:53779/Scripts/

SCRIPT1004: Expected ';'

Has anyone else come across this and can suggest a solution?

Answer Source

I stumbled on this by accident today and thought I should respond with an actual fix to this problem.

In my BundleConfig.cs I had the following:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(

The wildcard was being used to get the latest version of jQuery, however, the Bundle Builder was picking up the map file as well.

By updating the BundleConfig.cs as follows:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(

This solved the problem. The {version} token is a replacement that does a best match against the file. So now instead of all the files getting added you get a match on the library you are requesting for bundling and minification.

Source for this fix was found here