How can I make Visual Studio 2013 resolve Node.js

2019-06-27 04:22发布

问题:

I'm using Node.js 4.0.0 and Visual Studio 2013 Update 5. My code builds and runs just fine using Gulp, but I can't seem to get required modules to offer intellisense.

My project is an ASP.NET Web Application.

For example, I have a file as follows:

//constants/ActionTypes.js
'use strict';

module.exports = {
    REQUEST_FILES: 'REQUEST_FILES',
    RECEIVE_FILES: 'RECEIVE_FILES'
};

I then import it into another file with require:

'use strict';

var ActionTypes = require('../constants/ActionTypes');

ActionTypes. <--- does not offer intellisense completion.

I've installed the following Visual Studio extensions which I thought would help with this:

  • Node.js Tools 2.5
  • WebEssentials 2013.5 2.6.36

I had already setup my project before installing the Node.js Tools, and didn't use the Node.js Tools templates. Is there some type of configuration that I need to do to my existing project?

How can I get intellisense to resolve my module exports?