emscripten-core / emscripten-core/emscripten

Compatibility issues with requirejs and -sMODULARIZE

Open
#16,518 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Loading a module compiled with `-sMODULARIZE` fails after including requirejs. cf https://github.com/pyodide/pyodide/issues/2282

**Version of emscripten/emsdk:**
Tip of tree
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.8-git (6abf9a31795cc96023ed5213b15f3c90416409a7)
clang version 15.0.0 (https://github.com/llvm/llvm-project 5be0f0c83d39310d1c6c078ec5b0731c48d34080)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/hood/Documents/programming/emsdk/upstream/bin
```

## test.c:

```C
int main(){
return 0;
}
```
compile with `emcc -c test.c -o test.o`, and `emcc test.o -o test.js -sMODULARIZE=1`. Then:

## index.html

```html






```
gives:
```js
Uncaught Error: Mismatched anonymous define() module: function() { return Module; }
https://requirejs.org/docs/errors.html#mismatch
```

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.