Add esbuild cache
This improves build times for larger projects. Sadly it does not improve the memory usage as anticipated.
Sounds good to me, however one question, shouldn't we dispose the cached build on process end ? Or is the process cleaned out anyway ?
@olup I had the same question in mind.
@thomaschaaf Also, I see that incremental build is running in watch function which is run on before:offline:start, but also the normal building with incremental: false is run as well at the beginning of the hook.
Can we somehow improve it, so the first build in the before:offline:start would use incremental: true and the watch would use rebuild from cache?
This improves build times for larger projects. Sadly it does not improve the memory usage as anticipated.
@thomaschaaf I investigated on how to limit memory usage, but that's on esbuild and not possible as far as I can tell. However I just submitted a PR to limit the number of lambdas that are concurrently build, so you can keep memory consumption at reasonable levels while still building amazingly fast, here is the PR in case it is helpful:
https://github.com/floydspace/serverless-esbuild/pull/201
This PR and mine would probably conflict, happy to take a look when this gets merged to update mine @floydspace