We have consistently run into an issue where over time, as or codebase's size increases, our build process will fail from time to time due to memory running out. Our short term solution has been just to add more memory to the process, but this feels wrong on a lot of levels.
We've already removed any old and unused code, and taken what steps we can to reduce duplicate code, which did help some, but as the project gets larger we will hit this problem again.
One thought we had was to modularize sections of the project (this is something we want to do anyway), but we aren't sure this will improve memory use. We are also not sure where the boundaries should be (but it will likely involve moving our services to a shared module).
Are these good ideas, or are we barking up the wrong tree? What's the best way to reduce memory usage during webpack?