Skip to content

Commit e96c11c

Browse files
committed
Add __dirname and __filename globals
1 parent 18ed538 commit e96c11c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/app/src/sandbox/eval/transpiled-module.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,12 +775,17 @@ export default class TranspiledModule {
775775
: manager.evaluateTranspiledModule(requiredTranspiledModule);
776776
}
777777

778+
const globals = manager.testRunner.testGlobals(this.module);
779+
780+
globals.__dirname = pathUtils.dirname(this.module.path);
781+
globals.__filename = this.module.path;
782+
778783
const exports = evaluate(
779784
this.source.compiledCode,
780785
require,
781786
this.compilation,
782787
manager.envVariables,
783-
manager.testRunner.testGlobals(this.module),
788+
globals,
784789
{ asUMD }
785790
);
786791

0 commit comments

Comments
 (0)