execute .js script and land in REPL - similar to python -i script.py

Usage no npm install needed!

<script type="module">
  import easyRepl from 'https://cdn.skypack.dev/easy-repl';



-easily add a repl to your .js file with all the variables in the file in its scope

-similar to the -i flag in pyton, eg. python -i myscript.py

How to use

Add the following at the end of your myFile.js file

 if (require.main === module) {

Then from the command line, you can type node myfile.js and it will execute all functions in myfile.js and load all module level and global objects into your scope and throw you into a REPL so you can interactively debug your code.

Yes, you can do a .load myfile.js from within node, but that completely messes up your REPL history