Uxonith
Uxonith

Reputation: 1622

Reference files globally in VS Code (JS)

I have a website that I am using Grunt to concat files. I am wondering if there is currently some way to reference my Bower packages in all of my JS files as I use those packages within my files.

Example: I include 'moment' as a Bower package and then when I reference 'moment' in my JS file within VS Code I get a warning that 'moment' does not exist. This is annoying because I know it exists globally and would like to be able to manually reference it for code completion (and to get rid of the warning).

Upvotes: 6

Views: 2207

Answers (1)

João Moreno
João Moreno

Reputation: 691

You can omit the warning by adding the following to the top of your sources:

/*global moment*/

You can also create a globals.js file, add all those global definitions to it and reference it from your sources like this:

/// <reference path="global.js" />

Upvotes: 3

Related Questions