emscripten-core / emscripten-core/emscripten

Faulty assertion in node on .mjs files

Open
#17,465 4 comments 0 reactions 0 assignees View on GitHub
good first bug help wanted JavaScript
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

It turns out that node will disable the global `require` function on `foo.mjs` - that is just not defined there, unlike for `foo.js`. I guess mjs files are modules and require is not supposed to be used there. This ends up a problem for us since we have an assertion on it:

https://github.com/emscripten-core/emscripten/blob/a3d8979b38d2f655f59b040bfd32f562ebc92d03/src/shell.js#L196-L198

Removing that assertion is necessary to run an `.mjs` file in node with `-sASSERTIONS`.

We should probably just remove it?

This happens on binaryen CI which will manually builds an `.mjs` file by concatenating the emcc output with some extra code.

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.