码迷,mamicode.com
首页 > 其他好文 > 详细

[TypeScript] Configuring TypeScript Which Files to Compile with "Files" and "OutDir"

时间:2016-06-09 06:19:20      阅读:284      评论:0      收藏:0      [点我收藏+]

标签:

This lesson shows how to configure the .tsconfig so you only compile the .ts files you want. It then shows how to configure which directory you‘d like to compile the files to using "outDir".

 

tsconfig.json:

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": false,
        "sourceMap": false,
        "outDir": "./dist"
    },
    "files": [
        "main.ts"
    ]
}

 

We added "outDir": Output compiled file to dist folder.

The files we want to compile is main.js.

 

And main.js will be the main entry file, so for example we have another ts file called two.ts, we can import into main.ts:

import ./two;

class Person{

}

 

Then in the output file, we can see two.js is required into the module using common.js way:

"use strict";
require(./two);
var Person = (function () {
    function Person() {
    }
    return Person;
}());

 

[TypeScript] Configuring TypeScript Which Files to Compile with "Files" and "OutDir"

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5571872.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!