evanw / evanw/esbuild

Unnecessary resolutions in sideEffects: false package

Open
#3,255 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

When re-exporting nothing from a package that has sideEffects disabled, I would expect esbuild to discard the export completely. However, it seems to try to resolve all paths within the package unnecessarily.

I think this has a non-trivial performance impact on WASM.

## Reproduction

```ts
export {} from "viem"
```

https://stackblitz.com/edit/stackblitz-starters-b1bwlb?file=index.mjs

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked StackBlitz reproduction and compare resolution behavior for `export {} from "viem"` when the package has side effects disabled. Trace esbuild's package-resolution path for this empty re-export, then verify that unnecessary paths are no longer resolved and that the WASM reproduction shows the expected performance improvement.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, typescript, wasm
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.