@emarketeer/esbuild-plugin-tsc
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

@emarketeer/esbuild-plugin-tsc

An esbuild plugin which uses tsc to compile typescript files.

Why?

Esbuild natively supports typescript files - so if you are not using exotic typescript features this plugin is not meant for you!

I wanted to use typescripts emitDecoratorMetadata feature, which is not supported by esbuild. If you are only using typescript decorators in some files, this plugin allows you to convert only the files containing decorators and lets esbuild handle all other files. If for some reason you want to use typescripts compiler for all files you can simple set the force option.

Basic Usage

  1. Install this plugin in your project:

    npm install --save-dev @emarketeer/esbuild-plugin-tsc typescript
  2. Add this plugin to your esbuild build script:

    Javascript:

    +const esbuildPluginTsc = require('@emarketeer/esbuild-plugin-tsc');
     ...
     esbuild.build({
       ...
       plugins: [
    +    esbuildPluginTsc(),
       ],
     })

    Typescript:

    +import { esbuildPluginTsc } from '@emarketeer/esbuild-plugin-tsc';
     ...
     esbuild.build({
       ...
       plugins: [
    +    esbuildPluginTsc(),
       ],
     })

Config

esbuildPluginTsc{
    // If empty, uses tsconfig.json
    tsconfigPath?: string,
    // If true, force compilation with tsc
    force?: boolean,
    // If true, enables tsx file support
    tsx?: boolean
})

Package Sidebar

Install

npm i @emarketeer/esbuild-plugin-tsc

Weekly Downloads

320

Version

0.4.1

License

MIT

Unpacked Size

19.3 kB

Total Files

22

Last publish

Collaborators

  • hamid_sajjadi
  • ayankovsky