WhatBrokeToday
GTA 6FAQ
Bun

Bun --trim Flag Fails When Importing node:zlib

medium

Is it fixed? Not yet.

Ongoing since Nov 4, 12:46 UTC. First reported Nov 4, 12:46 UTC.

What happened

Importing node:zlib and running bun build with the --trim and --compile flags causes the compiler to incorrectly conclude that arbitrary property names are looked up at run time, preventing proper tree-shaking on Linux. The issue affects developers using Bun 1.4.4-canary.

What caused it?

Under active investigation. No report has identified a root cause yet.

No verified workaround yet

None of the linked reports describe a mitigation. This page updates when one appears.

Official fix

Timeline

  1. Investigating(current)
  2. Workaround available(upcoming)
  3. Resolved(upcoming)
  1. First report on GitHub issue

    --trim: importing node:zlib triggers 'the compiler can't tell which API this program uses' (keeps all locales, profiler, etc.)

    Source

Evidence

1 report · 1 GitHubShow
  1. [1]
    GitHub First report
    --trim: importing node:zlib triggers 'the compiler can't tell which API this program uses' (keeps all locales, profiler, etc.)(opens GitHub issue in a new tab)

    What version of Bun is running? 1.4.4-canary.1+cdfa19bba What platform is your computer? Linux 6.8.0-142-lowlatency x86_64 x86_64 What steps can reproduce the bug? // app.ts import { crc32 } from "node:zlib" console.log(crc32("hello")) bun build --compile --aot --trim --explain=trim app.ts --outfile app What is the expected behavior? Importing node:zlib does not make --trim conclude that arbitrary property names are looked up at run time (String.prototype.toLocaleLowerCase with a non-constant…

    by yoch 0upvotes 1comments

FAQ

What happened in the Bun issue?

Importing node:zlib and running bun build with the --trim and --compile flags causes the compiler to incorrectly conclude that arbitrary property names are looked up at run time, preventing proper tree-shaking on Linux. The issue affects developers using Bun 1.4.4-canary.

What is affected by the Bun issue?

Bun (versions: 1.4.4-canary.1+cdfa19bba).

When did the Bun issue start and end?

It started Nov 4, 12:46 UTC and is still ongoing (14 d 15 h so far). This page updates as it develops.

How do I get alerts for Bun?

Subscribe to the Bun RSS feed for every new Bun incident, or connect an AI assistant to WhatBrokeToday over MCP and ask whether Bun is down. Bun feed

Where does this information come from?

WhatBrokeToday collects public status pages, developer community reports and security advisories, groups the ones about the same problem, and links every report under Evidence on this page. This one has 1 report from 1 independent source.