Repository navigation
Convert module.exports = { foo: 'bar'} to ESM in bun build - #3103
Merged
Merged
Conversation
Contributor
|
❌ @Jarred-Sumner 27 files with test failures on linux-x64:
|
Contributor
|
❌ @Jarred-Sumner 27 files with test failures on linux-x64-baseline:
|
Contributor
|
❌ @Jarred-Sumner 32 files with test failures on bun-darwin-x64-baseline:
|
crishoj
added a commit
to crishoj/bun
that referenced
this pull request
Jul 29, 2026
PR oven-sh#3103 (May 2023) added this conversion together with a Zig loop-else bug that permanently disabled it: the trivial-property validation loop's only exit is `return null` — no `break` — so the `else` branch, intended as the empty-object de-opt, ran after every completed loop and the rewrite code was unreachable from day one. The Rust port mirrored the shipped behavior and deleted the dead rewrite code. Reconstruct the rewrite from the pre-rewrite Zig (maybe.zig at 23427db^), with two deliberate changes: - set esm_export_keyword like the live `exports.<name> = ...` conversion in visit_stmt.rs does (the never-run Zig omitted it), and - emit only one export clause per key, so a duplicate key in the object literal ({ foo: 1, foo: 2 }) reassigns the ref (last-wins) instead of producing a duplicate `export { $foo as foo }`. The empty-object case keeps de-opting, now via an explicit props.is_empty() check. cjs2esm/UnwrappedModuleRequireAssigned's __toESM assertion is updated: the fixture's `module.exports = { react: "react" }` now unwraps fully, so no interop helper remains. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.