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)[https://github.com/evanw/esbuild/issues/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
-
Install this plugin in your project:
npm install --save-dev esbuild-plugin-tsc typescript
-
Add this plugin to your esbuild build script:
+const EsbuildPluginTsc = require('esbuild-plugin-tsc');
...
esbuild.build({
...
plugins: [
+ EsbuildPluginTsc(),
],
})
Config
EsbuildPluginTsc{
tsconfigPath?: string,
force?: boolean,
tsx?: boolean
})