@matii96/nx-tsc
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Nx-tsc

MIT Licensed ci

Typescript executor for Nx workspace.

Why?

Nx only allows to use webpack as ts builder. While it has benefits like slightly reduced bundle size, it makes using build-reliant libraries like MikroORM a pain to use as it prevents distribution directory exploration.

How?

Nx-tsc eliminates this problem by introducing a full-fledged tsc build keeping hot-reload (serve) option.

Installation

$ npm i --save-dev @matii96/nx-tsc

Example

App's project.json:

{
  "root": "apps/my-app",
  "sourceRoot": "apps/my-app/src",
  "projectType": "application",
  "targets": {
    "build": {
      "executor": "@matii96/nx-tsc:build",
      "options": {
        "main": "apps/my-app/src/main.js",
        "tsConfig": "apps/my-app/tsconfig.app.json",
        "assets": ["apps/my-app/src/assets"]
      },
      "configurations": {
        "production": {
          "optimization": true,
          "extractLicenses": true,
          "inspect": false,
          "fileReplacements": [
            {
              "replace": "apps/my-app/src/environments/environment.ts",
              "with": "apps/my-app/src/environments/environment.prod.ts"
            }
          ]
        }
      }
    },
    "..."
  },
  "tags": []
}

App's tsconfig.app.json:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "../../dist/out-tsc/my-app",
    "..."
  },
  "..."
}

Nothing changes in serve and build commands:

$ nx serve my-app
$ nx build my-app

Options

Property What it does Required
main The name of the main entry-point file
tsConfig The name of the Typescript configuration file
assets List of static application assets
watch Run build when files change
debounceTime Debounce timeout after last file change for watch mode

License

Nx-tsc is MIT licensed.

Package Sidebar

Install

npm i @matii96/nx-tsc

Weekly Downloads

5

Version

1.1.0

License

MIT

Unpacked Size

31.5 kB

Total Files

33

Last publish

Collaborators

  • matii96