serverless-esbuild icon indicating copy to clipboard operation
serverless-esbuild copied to clipboard

Add esbuild cache

Open thomaschaaf opened this issue 4 years ago • 3 comments

This improves build times for larger projects. Sadly it does not improve the memory usage as anticipated.

thomaschaaf avatar Mar 16 '21 20:03 thomaschaaf

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 avatar Mar 17 '21 09:03 olup

@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?

floydspace avatar Mar 17 '21 09:03 floydspace

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

JoaquinFernandez avatar Sep 30 '21 12:09 JoaquinFernandez