knaka Tech-Blog

AI, IoT, DIYエレクトロニクス, データサイエンスについて投稿予定です。

TypeScript, tsconfigでの自動コンパイル #TypeScript #javascript

index:

概要:

前の TypeScript 関連となり
tsconfig.json を使用した、自動コンパイル方法です

環境

TypeScript
node.js
npm

コンパイル方法

tsconfig.json
https://github.com/kuc-arc-f/ts_start2/blob/master/tsconfig.json
dist の下に、出力されます

{
  "compilerOptions": {
    "target": "es6",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    "outDir": "./dist",                        /* Redirect output structure to the directory. */
    "strict": true,                           /* Enable all strict type-checking options. */
    "esModuleInterop": true                   /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
  }
}

tscコマンド
下記プロセスを、起動きておきます。
tsファイルがコンパイルされます。

tsc -W

参考の設定

github.com

関連のページ

knaka0209.hatenablog.com