@emarketeer/esbuild-plugin-tsc
v0.4.1
Published
An esbuild plugin which uses tsc to compile typescript files.
Downloads
1,109
Readme
@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
Install this plugin in your project:
npm install --save-dev @emarketeer/esbuild-plugin-tsc typescript
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
})