标签:
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