jgoz / esbuild-plugins

My esbuild plugins monorepo
MIT License
40 stars 4 forks source link

@jgoz/esbuild-plugin-typecheck has issue reading tsconfig with `extends` #109

Closed KurtPreston closed 5 months ago

KurtPreston commented 5 months ago

I have a project structure like:

src/
  client/
    tsconfig.json
  server/
    tsconfig.json
tsconfig.base.json

Where src/client/tsconfig.json and src/server/tsconfig.json both declare "extends": "../../tsconfig.base.json".

When I pass src/client/tsconfig.json to TypeScript, normally it extends the configuration specific in my project root tsconfig.base.json. However, when I pass this file to typecheckPlugin like:

typeCheckPlugin({
  configFile: 'src/client/tsconfig.json'
})

I receive the error error TS5083: Cannot read file '/home/USER/tsconfig.base.json'. It seems to be resolving the path from my project root, instead of from the location of the tsconfig.json file. Passing the file as an absolute path results in the same behavior. How can I get it to correctly resolve the location of tsconfig.base.json?

These are some great plugins, thank you for creating and maintaining them!

jgoz commented 5 months ago

Hey there, thanks for catching this!

I think I was able to reproduce it and attempted a fix in @jgoz/esbuild-plugin-typecheck@3.1.2. Please give it a try!

KurtPreston commented 5 months ago

Works great, thank you!