When I run the script, my application first creates an object that I will use in all my applications.
Object creation takes up to 10 seconds. So when I try to test any new piece of code, I have to wait 10 seconds each time.
The app is going to be big enough, I can't wait that long when I add a new line of code. How to deal with this? Is there a way to save the state of the script from some point and run it every time from the point with this "heavy" object already initialized.
Assuming that heavy object is something that will not change often, you could try exporting it like this
const heavyObj = {};
module.exports = heavyObj ;
After that import the object wherever you need
const heavyObj = require('./data.js')