diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index ffa05bb742..63a3737563 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -735,6 +735,8 @@ function require (path) { } } + sandbox.__filename = origin; + sandbox.__dirname = typeof origin === 'string' ? origin.split('/').slice(0, -1).join('/') : origin; sandbox.module = module; sandbox.exports = module.exports; sandbox.require = function(path) { return module.require(path); }; @@ -1326,6 +1328,8 @@ function require (path) { } } + sandbox.__filename = full; + sandbox.__dirname = full.split('/').slice(0, -1).join('/'); sandbox.module = appModule; sandbox.applicationContext = appContext;