usabilityhub / rails-erb-loader

Embedded Ruby (.erb) webpack loader for Ruby projects.
MIT License
103 stars 28 forks source link

Separate server process for each file? #73

Open zachmccormick opened 5 years ago

zachmccormick commented 5 years ago

I may be mistakenly reading the logs/results I'm getting, but it seems like this boots a totally separate server process for each file that it needs to template, meaning that unless you use Spring to cache classes in memory, this will be rather slow.

My project necessitates that I can't do that. Would it be too difficult to start a Ruby process, load in the Rails configuration, then just keep that process around, running the ERB template process inside of the same process each time? If it's something that seems possible I'll try to make a PR in the next few weeks for it.

zachmccormick commented 5 years ago

I should have browsed the closed comments before this. https://github.com/usabilityhub/rails-erb-loader/issues/66 is fairly relevant

rhys-vdw commented 5 years ago

Yeah as I mentioned in #66 (which I didn't realize had been closed) I think that would be ideal.

I think that solution will be possible. I guess we could just "lock" the process and send the files one at a time. Alternatively there could be a pool of processes.

The irony of the current behavior is that spring actually causes hangs so even though it's unbearable to disable it, it's often required.

I'd love it if you could take a look at implementing such a thing. I've also been considering dropping the ancient JS approach and moving to TypeScript. LMK if you'd like me to do that before you start. Might make editing more ergonomic.