How do I load my script into the node.js REPL?
问题 I have a script foo.js that contains some functions I want to play with in the REPL. Is there a way to have node execute my script and then jump into a REPL with all the declared globals, like I can with python -i foo.py or ghci foo.hs ? 回答1: There is still nothing built-in to provide the exact functionality you describe. However, an alternative to using require it to use the .load command within the REPL, like such: .load foo.js It loads the file in line by line just as if you had typed it