zoukankan      html  css  js  c++  java
  • [TypeScript] Configuring TypeScript Which Files to Compile with "Files" and "OutDir"

    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;
    }());
  • 相关阅读:
    Swift
    Swift
    Swift
    Swift
    Swift
    nineOldAnimation 应用
    Android 编程下 Touch 事件的分发和消费机制
    用Gradle 构建android程序
    CygWin模拟Linux环境进行Ant批量打包
    UML类图与类的关系详解
  • 原文地址:https://www.cnblogs.com/Answer1215/p/5571872.html
Copyright © 2011-2022 走看看