Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[wasm-opt] `--minify-imports-and-exports-and-modules` does not report module renames.

Abierto
#7,657 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
wasm
Área
cli, compilers

Línea de trabajo

Comienza reproduciendo el problema con wasm-opt versión 123 usando el test.wat proporcionado, el comando wat2wasm y la opción --minify-imports-and-exports-and-modules. Inspecciona la salida de mapeo de la opción y compárala con la salida de wasm2wat; se considera terminado cuando stdout informa de los renombrados tanto de módulos como de funciones, incluidos los nombres de módulos fusionados.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

When using wasm-opt with the --minify-imports-and-exports-and-modules flag, the tool correctly minifies both the import module names and the import function names. It often merges multiple import modules into a single new minified name.

However, the mapping printed to stdout is incomplete. It includes the remapping for the function names but completely omits the remapping for the module names. This makes it impossible for tools that rely on this map to correctly patch the host JavaScript environment, breaking the application.

Environment
  • wasm-opt Version: wasm-opt version 123
Minimal Reproducible Example (MRE)

1. Input .wat file (test.wat):

This file defines a module that imports two functions from two different, uniquely named modules.

(module
  (type (;0;) (func))
  (import "long_module_name_a" "long_function_name_foo" (func (;0;) (type 0)))
  (import "long_module_name_b" "long_function_name_bar" (func (;1;) (type 0)))
)

2. Assemble to .wasm:

wat2wasm test.wat -o test.wasm

3. Run wasm-opt:

wasm-opt test.wasm -o output.wasm --minify-imports-and-exports-and-modules
Results
Actual stdout Output:

The tool only prints the mapping for the function names:

long_function_name_foo => a
long_function_name_bar => b
Actual Contents of output.wasm (decompiled with wasm2wat):

The output Wasm shows that the module names were also minified and merged into "a":

(module
  (type (;0;) (func))
  (import "a" "a" (func (;0;) (type 0)))
  (import "a" "b" (func (;1;) (type 0)))
)
Expected Behavior

The stdout mapping should be complete and reflect all minification operations performed on the import/export interface. A correct and unambiguous output would look something like this:

long_module_name_a => a
long_module_name_b => a
long_function_name_foo => a
long_function_name_bar => b

This would provide all the necessary information for a host environment to correctly wire up the minified module.

Lenguaje dominante
WebAssembly
Estrellas
8.6k
Forks
885
Merge medio
2 d 4 h
PR fusionados (30 d)
77

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de WebAssembly/binaryen

Todos los issues de WebAssembly/binaryen

Issues similares

Más issues de CLI

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.