首页 > 其他 > 详细

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

时间:2016-06-09 06:18:12      阅读:162      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!