Skip to content

Commit 4146d99

Browse files
authored
fix(build): disable identifier minification to fix marked crash (#617)
## Summary Fixes the compiled binary crash that affected all commands rendering markdown output (auth status, issue explain, etc.): ``` TypeError: _4 is not a function. (In '_4(_4.tokens)', '_4' is an instance of Object) ``` ## Root Cause Bun's identifier minification assigns short names (`_4`, `_5`, etc.) to all functions/variables. A name collision caused `renderInline` (a function in `markdown.ts`) to get the same minified name as an unrelated object. When `renderOneInline` calls `renderInline(token.tokens)`, the minified code calls `_4(_4.tokens)` — but `_4` is the object, not the function. Triggered by PR #602 (716e2ba) which removed ~380 lines of code, shifting the minifier's naming sequence. The bug is in Bun's bundler, not our source code — any future code change could re-trigger it. ## Fix Change `minify: true` to `minify: { whitespace: true, syntax: true, identifiers: false }` in `script/build.ts`. This keeps whitespace removal and syntax transforms while avoiding identifier renaming. **Size impact:** Bundle grows from 2.87 MB to 3.64 MB raw (~27%). Gzip compression absorbs most of the difference since original identifier names compress well. ## Bisect - `27a9f0f8` (PR #610) — works - `716e2bad` (PR #602) — crashes - Specifically: the change to `src/commands/issue/explain.ts` triggers the collision by shifting import ordering ## Test plan - `SENTRY_CLI_BINARY=./dist-bin/sentry-darwin-arm64 bun test --timeout 15000 test/e2e` — 122 pass, 0 fail - `SENTRY_AUTH_TOKEN=test ./dist-bin/sentry-darwin-arm64 auth status` — renders markdown without crash Made with [Cursor](https://cursor.com)
1 parent 44d604c commit 4146d99

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

script/build.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ async function bundleJs(): Promise<boolean> {
9696
"process.env.NODE_ENV": JSON.stringify("production"),
9797
},
9898
sourcemap: "external",
99-
minify: true,
99+
// Identifier minification causes name collisions in the `marked` library's
100+
// token walker — renderInline gets the same minified name as an unrelated
101+
// object, crashing `auth status` and other markdown-rendering paths.
102+
// Whitespace + syntax minification still reduces size significantly.
103+
minify: { whitespace: true, syntax: true, identifiers: false },
100104
target: "bun",
101105
});
102106

0 commit comments

Comments
 (0)