evanw / evanw/esbuild

Too many small chunks

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

Description

We're using Remix, which uses esbuild, and our webapp build produces 91 chunks, about 50% of which are less than 1kb, which means our webpages import around 30-35 chunks, which I think is really inefficient for the browser.

Are there any good work arounds to avoid this?

One of our chunks is:

```
var e="web";export{e as a};
```

This appears to be coming from a single typescript file with a single constant in it... so I guess I can fix that by moving the constant to another file.

There are a few like this:

```
import{b as o}from"/build/_shared/chunk-2LOM2E4Y.js";var p=o((r,e)=>{e.exports={}});export{p as a};
//# sourceMappingURL=/build/_shared/chunk-SIMRMZHU.js.map
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file, test, or specific entry point is named. Start by reproducing the reported Remix build with 91 chunks and inspect how the small TypeScript and CommonJS-derived chunks are generated. Done means identifying a supported way to reduce unnecessary chunks without breaking the webapp output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.