I have this situation: a sandboxed module loads sequelize, which in turn loads the sqlite3 module.
sqlite3 has a native module (.node) implementation. Somewhere in the chain of calls to require sandboxed-module tries to compile the content of the native module as source code, which leads to an error, obviously.
I have worked around this issue locally by adding a check if the extension of the file to be loaded is ".node":
if (builtinModules.indexOf(request) >= 0 || path.extname(request) == ".node") {
if (request in cache) return cache[request];
return require(request);
}
I am happy to submit a pull request if you find this okay.
I have this situation: a sandboxed module loads sequelize, which in turn loads the sqlite3 module. sqlite3 has a native module (.node) implementation. Somewhere in the chain of calls to require sandboxed-module tries to compile the content of the native module as source code, which leads to an error, obviously.
I have worked around this issue locally by adding a check if the extension of the file to be loaded is ".node":
I am happy to submit a pull request if you find this okay.