emscripten-core / emscripten-core/emscripten

Tracking issue - WASM_BINDGEN snippets support changes

Open
#27,665 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 6h
Merged PRs (30d)
109

Description

This is a tracking issue from https://github.com/emscripten-core/emscripten/pull/27208#discussion_r3929655457.

wasm-bindgen outputs directly to a snippets folder for external inline code snippets, but does not optimize these into the single JS file itself. As a result this folder must be copied with the wasm-bindgen output files.

These are distinct from Emscripten-style inline code because they assume module syntax like an ES module file themselves - supporting `import 'dep'` and using their `export` interface as the snippet interface.

In future two possible optimizations could arise here:

1. Emscripten doing the single-file JS optimization to inline these static known imports
2. wasm-bindgen adding support for this optimization itself

In either of these cases, copying the snippets directory to support inline code would no longer be need which this tracks.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked PR discussion and the issue's description of wasm-bindgen's snippets folder and module syntax. Compare the two proposed optimization paths: Emscripten inlining static imports or wasm-bindgen providing the optimization. Done is defined only generally here: the snippets directory would no longer need to be copied with wasm-bindgen output.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.