Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add esbuild cache #101

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

thomaschaaf
Copy link

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

@@ -152,17 +154,19 @@ export class EsbuildPlugin implements Plugin {
async watch(): Promise<void> {
const options = {
ignored: this.buildOptions.watch.ignore,
awaitWriteFinish: true,
awaitWriteFinish: {
stabilityThreshold: 50,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this it there because before it would wait 2000 ms just until it would start compiling changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds reasonable when taking into account the size of a typical code file. But if half saved code gets compiled we'll have to higher this value a little bit (I think a couple of hundreds should still give a smooth experience but prevent any weirdness)

@olup
Copy link
Contributor

olup commented Mar 17, 2021

Sounds good to me, however one question, shouldn't we dispose the cached build on process end ? Or is the process cleaned out anyway ?

@floydspace
Copy link
Owner

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

@JoaquinFernandez
Copy link

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:

#201

This PR and mine would probably conflict, happy to take a look when this gets merged to update mine @floydspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants