Search code examples
typescriptnpmtsconfigesbuild

tsconfig's outDir vs esbuild's outdir


What is the difference between tsconfig's outDir vs esbuild's outdir? Seems like the do the same thing. esbuild supposedly detects the tsconfig, so which should I use? This is for a TypeScript library on npm.


Solution

  • Only certain features of tsconfig.json are used by esbuild:

    esbuild currently only inspects the following fields in tsconfig.json files:

    • alwaysStrict
    • baseUrl
    • extends
    • importsNotUsedAsValues
    • jsx
    • jsxFactory
    • jsxFragmentFactory
    • jsxImportSource
    • paths
    • preserveValueImports
    • target
    • useDefineForClassFields

    Therefore you should use esbuild's outdir, the outDir configuration in tsfonfig.json will have no effect.