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

[Feature]: fine grained cache control for incremental api #1980

Open
hardfist opened this issue Feb 2, 2022 · 1 comment
Open

[Feature]: fine grained cache control for incremental api #1980

hardfist opened this issue Feb 2, 2022 · 1 comment

Comments

@hardfist
Copy link
Contributor

hardfist commented Feb 2, 2022

We heavily use js plugins on top of esbuild to build complex projects(less、css module、postcss and so on),
esbuild is much faster than webpack in first full build, but esbuild is not faster than webpack on incremental rebuild since webpack has nice cache strategy for incremental rebuild.
take loader for example, which supports cacheable, which is true by default,
it can heavily reduce the cost in rebuild(this loader hooks is not called for unmodified file), and parcel has similar api cache-invalidation,
I'm wondering whether esbuild could provides similar api for cache invalidate management.
even though we could implement some cache strategy in js plugin, but it still takes some cost of go|js communication, which could be reduced by esbuild's internal cache invalidation.

const lessPlugin = {
  name: 'lessPlugi',
  setup(build){
    build.onLoad({filter:/\.less$/, args => {
       const contents = lessRender(args);
       return {
          contents,
          cacheable: true // the js plugin will never be called for unmodified less file
       }
   })
  }
}
@hardfist
Copy link
Contributor Author

Even I caching every result of onResolve and onLoad, the plugin communication for large project is too high, so without caching strategy in esbuild it self, it seems not possible to solve incremental performance problem.
In myproject, incremental rebuild needs to call 15651 plugin, even though the plugin does nothing, the plugin communication costs 800ms in my mac.
image

so it seems that current incremental solution may not scale well.

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

No branches or pull requests

1 participant