After my test, I found that this phenomenon does exist. I created two JS files in the project:
main.js:
var message = MyApp.Utilities.sayHello("World");
console.log(message);
var sum = MyApp.Utilities.addNumbers(5, 7);
console.log(sum);
app.js:
var MyApp = MyApp || {};
MyApp.Utilities = {
sayHello: function (name) {
return "Hello, " + name + "!";
},
addNumbers: function (a, b) {
return a + b;
}
};
When I rebuild the solution and restart VS, the main.js content is displayed by default. No matter you click sayHello or addNumbers and use F12, you will not be redirected to the method defined in app.js. Even if you right-click sayHello or addNumbers and click go to definition, you will not be redirected to the method defined in app.js. The F12 go to definition function will only work when you click on the app.js file, load the content inside, and then return to main.js. This may be a bug in VS. If you find it troublesome to always open the JS file for method definition, I suggest you report this bug to DC. DC has many VS developers who should be able to help you.