Skip to content

Instantly share code, notes, and snippets.

@gimelfarb
Created August 24, 2014 20:39
Show Gist options
  • Select an option

  • Save gimelfarb/923fce133d7b81b35780 to your computer and use it in GitHub Desktop.

Select an option

Save gimelfarb/923fce133d7b81b35780 to your computer and use it in GitHub Desktop.
JavaScript Intellisense broken tilde-slash path references
/// <reference path="~/www/js/r.js" />
load();
var x = t();
// type: x. -> Intellisense
// It won't work, and will complain that cannot load ~/www/js/a.js in the JavaScript Intellisense console window
function t()
{
return "t";
}
function load() {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.setAttribute('src', '~/www/js/a.js'); // /www/js/a.js doesnt work either!
// but a full path C:\mysystem\local\path\to\project\www\js\a.js does ...
head.appendChild(script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment