Answer the question
In order to leave comments, you need to log in
How to access global context from REPL?
The idea is to initialize the main points in the js file, and then communicate with Node.js through the console - so that each time you do not do the same thing - rewrite the file and restart the node.
But here's the problem - the variables created in the file are not available in the console context:
'use strict';
const repl = require('repl');
let x = 1;
repl.start({});
> x
ReferenceError: x is not defined
>
repl.start({
useGlobal:true
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question