Using external modules in Visual Studio 2015 CTP6 + TypeScript 1.4

后端 未结 1 1712
故里飘歌
故里飘歌 2021-02-09 10:52

I\'m trying to figure out how to import modules. When I write a statement at the top of my .ts file such as:

import a = require(\"a\");

I get t

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-09 11:28

    Here are the steps to configure typescript per project:

    1. Unload your project. If your project is based on the MVC 6 template, you will find that the MSBuild configuration is pretty minimal.

    2. Navigate to: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript*

      * This assumes you installed VS in the default location.

    3. Locate the Microsoft.TypeScript.Default.props file and open it up. No need for elevated privileges, we will only be reading from it.

      It should look something like:

      
      
        
          ES5
          true
          false
          none
          false
          
          
          false
          true
          
          
          true
        
      
      
    4. Copy the entire PropertyGroup element, and paste it somewhere in your .kproj file; it needs to be under the Project element.

    5. Modify the TypeScriptModuleKind from none to your module definition. The options are AMD or CommonJS.

    6. Save the .kproj file, and reload your project.

    You should no longer get the compile-time error about including modules.

    0 讨论(0)
提交回复
热议问题