Skip to content

Commit 747ab97

Browse files
authored
chore: enable require in non-repl mode (#1887)
1 parent 49ce0aa commit 747ab97

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/cli-repl/src/mongosh-repl.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ class MongoshNodeRepl implements EvaluationListener {
279279
});
280280
}
281281
context.global = context;
282+
context.require = require('node:module').createRequire(
283+
process.cwd() + '/index.js'
284+
);
282285
}
283286

284287
const console = new Console({

0 commit comments

Comments
 (0)