In an MVC project, I tried 2 ways to include jQuery:
with bundle setting in BundleConfig.cs
like this:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/JQuery/jquery-{version}.js"));
- use NPM, in the repo, I did
npm install jquery@3.1.0
, then inBundleConfig.cs
, set up the bundle like this:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/node_modules/jquery/dist/jquery.min.js"));
Both 1 and 2 works. Obviously I should use 2, cause people say NPM is better. However, I'm not using the latest jQuery version, I do not have the need to upgrade jQuery at the moment, and I will use jQuery 3.1.0 for a long time. I thought about upgrading jQuery to the latest but here it says I should not: Practical approach to keeping jQuery up to date?, also tried it and broke the entire website.
Why is 2 better than 1? All I can see is 2 includes jQuery from a different path. Am I missing anything?