Skip to content

An esbuild plugin which uses tsc to compile typescript files.

License

Notifications You must be signed in to change notification settings

AnatidaeProject/esbuild-plugin-tsc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)[https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata] feature, which is (not supported by esbuild)[evanw/esbuild#257]. 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 esbuild-plugin-tsc typescript
  2. Add this plugin to your esbuild build script:

    +const EsbuildPluginTsc = require('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
})

About

An esbuild plugin which uses tsc to compile typescript files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%