solidusjs / solidus

A simple server that generates pages from JSON and Templates
MIT License
28 stars 7 forks source link

Preprocessor changes require a server restart to take effect #144

Closed pushred closed 7 years ago

pushred commented 7 years ago

Looks like a regression of #37 probably a side effect of #139. Workers were reloaded previously on file change events to handle this.

pushred commented 7 years ago

This issue actually has to do with the use of modules to group preprocessors together. We clear only the preprocessor file that is changed from the require cache but not any that require it. In some cases a view could be requiring a parent module that is still held in the cache. Cached modules also include any child modules they've required in the same cache entry.

To fix this I'll clear all preprocessors in the cache, but not any installed modules, since traversing the cached children for each and doing comparisons therein is likely much more expensive. I'm not even able to inspect those objects, not sure what they contain exactly.