emscripten-core / emscripten-core/emscripten
`locateFile`: Support loading a data URL or Uint8Array
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
[locateFile](https://emscripten.org/docs/api_reference/module.html#Module.locateFile) takes a relative file path and returns a URL.
[I do not think data URL's work](https://github.com/sql-js/sql.js/issues/554) when running in Node.js.
[esbuild](https://esbuild.github.io/content-types/#binary) and other bundlers allow bundling .wasm files as Uint8Array's.
It would be useful to be able to return a `Uint8Array` or data URL from `locateFile` to bundle the .wasm with a JS bundle (this would avoid having to ship a .wasm file to a CDN or with a Node.js script).
I know the SINGLE_FILE emcc arg exists, but many Emscripten projects avoid this to make the output files more accessible/debuggable.
Contributor guide
Assessment
This issue has not been assessed yet.