emscripten-core / emscripten-core/emscripten

locateFile() not called for .js with `EXPORT_ES6`

Open
#22,508 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Using emscripten 3.1.65 and `-sEXPORT_ES6=1`, the following .js is generated

```js
function allocateUnusedWorker() {
var worker;
var workerOptions = {
type: "module",
name: "em-pthread"
};
worker = new Worker(new URL("ffmpeg-lgpl-simd.js",import.meta.url),workerOptions);
PThread.unusedWorkers.push(worker)
},

function findWasmBinary() {
if (Module["locateFile"]) {
var f = "ffmpeg-lgpl-simd.wasm";
if (!isDataURI(f)) {
return locateFile(f)
}
return f
}
return new URL("ffmpeg-lgpl-simd.wasm",import.meta.url).href
}
```

The problem is `allocateUnusedWorker()` is not calling `locateFile()` (as `findWasmBinary()` does) making it hard to customize the URL. Please enhance `allocateUnusedWorker()` to call `locateFile()` before constructing .js url

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.