To offload the script, you can do this:
delete require.cache['/your/script/absolute/path'] // delete the cache var yourModule = require('/your/script/absolute/path') // load the module again
So, if you have plugin modules, you can observe the changes in these files, then dynamically upload (delete the cache), and then request the script again.
But make sure you don't skip memory; you can reassign the changed module to an old variable. Here is a handy tool that you can check in memory: node-memwatch .
Good luck
source share