Saturday, September 10, 2016

Require is required but it can't find require.d.ts

I've just released a fairly significant update to the VSTS Extension Project Templates extension.  Recently a few of the ALM Rangers noticed that there was a problem with a missing TypeScript definition file that seemed to crop up out of nowhere.  The file (require.d.ts) was not in the template's file system previously as it had not been needed by the underlying VSS SDK definition files (VSS.d.ts and TFS.d.ts).  A recent change, however, has revealed that a new dependency was introduced:
To remedy this, I added the DefinitelyTyped d.ts file for RequireJS.  Many thanks to Wouter de Kort and Utkarsh Shigihalli for reporting this, and to David Corbin for helping me beta test this fix!

Now, this release wasn't just a hotfix.  There were several other enhancements and updates that made it in, thanks to suggestions from my friend Max Knor:
  • Changed PowerShell execution to PowerShell3 in task.json
  • Included vsts-task-sdk in Build/Release Task template
  • Added Trace-VstsEnteringInvocation and Trace-VstsExitingInvocation to example task PowerShell scripts
  • Updated versions for Grunt, Jasmine 
For some great contributions to the VSTS extension pool, check out Max's extensions on the VS Marketplace:

Patching previous versions
If you've run into a roadblock with running or building your existing extension project, the easiest way to get back on track is to create a folder under the typings folder in the project for requirejs, and in that folder place a copy of the require.d.ts file:

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/requirejs/require.d.ts