When trying to use src/luaconf.js unmodified in a browser environment, you will get an error like "ReferenceError: process is not defined", since the global process is not defined in a browser environment.
This can easily be fixed by checking typeof process !== "undefined" (as it is already done in other places of fengari):
diff --git a/src/luaconf.js b/src/luaconf.js
index 387e813..422bbfd 100644
--- a/src/luaconf.js
+++ b/src/luaconf.js
@@ -1,6 +1,6 @@
"use strict";
-const conf = (process.env.FENGARICONF ? JSON.parse(process.env.FENGARICONF) : {});
+const conf = (typeof process !== "undefined" && process.env.FENGARICONF ? JSON.parse(process.env.FENGARICONF) : {});
const {
LUA_VERSION_MAJOR,
When trying to use src/luaconf.js unmodified in a browser environment, you will get an error like "ReferenceError: process is not defined", since the global
processis not defined in a browser environment.This can easily be fixed by checking
typeof process !== "undefined"(as it is already done in other places of fengari):