Skip to content

Handle module name collisions in MinifyImportsAndExports using a new output format#8550

Open
kripken wants to merge 7 commits intoWebAssembly:mainfrom
kripken:mimps.collide
Open

Handle module name collisions in MinifyImportsAndExports using a new output format#8550
kripken wants to merge 7 commits intoWebAssembly:mainfrom
kripken:mimps.collide

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Mar 30, 2026

Before we just minified the basename, ignoring the module name entirely. That
meant we errored if two modules had the same basename,

(import "A" "foo" ..)
(import "B" "foo" ..)

Fix this by tracking module names alongside base names.

The output format must change to support this, as we need to print out the
module name as well. While making a breaking change here, change the
output to JSON which will handle escaping properly, and is more structured
and explicit.

Fixes #8203

Needs a corresponding Emscripten change to parse the new output format.

kripken added a commit to emscripten-core/emscripten that referenced this pull request Mar 30, 2026
…C] (#26578)

The new format uses JSON and supports overlapping module names.

Corresponding Binaryen change:
WebAssembly/binaryen#8550
}
}
std::cout << "\n ]\n";
std::cout << "}\n";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does binaryen write json elsewhere? If so mabye we can make utilities for dumping this kind of data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MinifyImportsAndExports fails on duplicate names.

2 participants