js-wasmc
js-wasmc copied to clipboard
Possible codegen issue with Deno
See https://github.com/rsms/markdown-wasm/issues/6
It appears as Emscripten generates the following code:
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
// ...
if (document.currentScript) {
// ...
which when executed in Deno causes a crash (since there's no document in deno.)
The above code is fenced (again, by emscripten) by the following constants:
ENVIRONMENT_IS_WEB = typeof window === "object";
ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
ENVIRONMENT_IS_NODE = ENVIRONMENT_HAS_NODE && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER;
wasmc overrides ENVIRONMENT_IS_WEB only when target:"web" is explicitly defined in a wasmc.js file
Note: This may turn out to be a non-issue. Just filing so to remember to check it out.