Created
February 17, 2023 10:30
-
-
Save Stradivario/19fb7bdd2b732b42d55c0a46b623c54f to your computer and use it in GitHub Desktop.
How to emit type declarations in esbuild using tsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// esbuild.js | |
import { execSync } from 'child_process' | |
import { build } from 'esbuild' | |
build({ | |
...options, | |
plugins: [ | |
{ | |
name: 'TypeScriptDeclarationsPlugin', | |
setup(build) { | |
build.onEnd((result) => { | |
if (result.errors.length > 0) return | |
execSync('tsc') | |
}) | |
} | |
} | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment