Skip to content

MsBuild compiler options don't support node modules properly #6625

@ehamai

Description

@ehamai

I'm trying to get the Angular2 beta to work with ASP.Net Web API but can either get intellisense with the Angular2 node libraries to work in Visual Studio, or compiling to work, but not both. The project I'm referring to is here: https://github.com/Tuesdaysgreen/angular2-webapi

According to your msbuild documentation, you should specify "NodeJs" instead of "node" for the TypeScriptModuleResolution for node modules projects. If I use this, then the Visual Studio editor is able to resolve the Angular2 node libraries, but if I try to compile, I hit this error:

Build: Argument for '--moduleResolution' option must be 'node' or 'classic'. angular2-webapi C:\git\angular2-webapi\angular2-webapi\VSTSC

If I change TypeScriptModuleResolution to "node" instead of "NodeJs", then I can compile, but lose intellisense for the Angular2 node modules in the editor. For example, when I hover over the error from this import statement, it says "cannot find module "angular2/core"

import {Component} from 'angular2/core'

Here's my TypeScript arguments from my csproj file:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptJSXEmit>None</TypeScriptJSXEmit> <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled> <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny> <TypeScriptModuleKind>System</TypeScriptModuleKind> <TypeScriptRemoveComments>False</TypeScriptRemoveComments> <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations> <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError> <TypeScriptSourceMap>True</TypeScriptSourceMap> <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators> <TypeScriptModuleResolution>NodeJs</TypeScriptModuleResolution> <TypeScriptEmitDecoratorMetadata>true</TypeScriptEmitDecoratorMetadata> </PropertyGroup>

It seems like the module resolution should always be "node" instead of "NodeJs", so I'm not sure if this is a VS bug, or an msbuild bug, or a TypeScript compiler bug but I figure I would start here. Please let me know if you need any more info.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions