> On Nov 10, 2015, at 6:51 PM, Sean Wolfe <
swo...@kabaminc.com> wrote:
>
> I'm new to node, getting used to the ecosystem. One thing I've noticed is that when I save changes to files, the server restarts, which takes 7-15 seconds each cycle.
That restarting behavior is not inherent -- that's something the server or build system you're using chose.
>
> What sort of hotswap / hotplugging options are out there? I see
>
>
https://www.npmjs.com/package/hotswap
>
> which I'm working with but haven't got working yet. Also that repo is a couple years since the last commit.
the problem is that references to old versions can still be loaded -- it will behave differently, in theory, than freshly loaded. Not a problem in some cases, definitely a source of mysterious bugs in others. Any tool like this is going to be very focused on particular cases, or ignoring edge cases entirely. There's no general solution for how hot swapping should be done.
>
> Is hotplugging code, ie. reloading individual changed files without restarting, popular for node? Are there other npm's that I'm not finding? Why isn't this supported out of the box? Also, is 7-15 seconds a long time for a nodejs server? I'm guessing yes ...
Indeed: My approach has been to build smaller servers that do less (and less at startup), and if possible with well defined single purposes.
npm's website starts in about 2 seconds for me, I want to get that time down to 250ms at some point. That's my personal approach right now.
Aria