evanw / evanw/esbuild

resolve hook doesn't respect tsconfig's compilerOptions

Open
#2,265 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tsconfig
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

It seems that esubuild's buitin resolve will return more information about tsconfig than resolve hook, which will affect transform result such as `UseDefineForClassFields`
https://github.com/evanw/esbuild/blob/master/internal/bundler/bundler.go#L788-L810 resolve hook doesn't support return anything about tsconfig. you can see difference in the demo here https://github.com/hardfist/esbuild-bug/tree/main

we can fix this if we support pass compilerOptions to esbuild directly other than rely on resolve result about tsconfig(which seems rarely useful and inefficient for real world case and rollup and webpack doesn't support this)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the linked demo, then inspect internal/bundler/bundler.go at lines 788-810 and compare built-in resolve behavior with the resolve hook. Trace how tsconfig compilerOptions reach the transform result, including UseDefineForClassFields. Done means the resolve-hook path produces the same relevant compilerOptions behavior as built-in resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, typescript
Domain
build-system, compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.