Skip to content

fix: cache usage of modern-node-polyfills API#115

Merged
imranbarbhuiya merged 4 commits intoimranbarbhuiya:mainfrom
markdalgleish:cache-polyfills
Jun 20, 2023
Merged

fix: cache usage of modern-node-polyfills API#115
imranbarbhuiya merged 4 commits intoimranbarbhuiya:mainfrom
markdalgleish:cache-polyfills

Conversation

@markdalgleish
Copy link
Contributor

@markdalgleish markdalgleish commented Jun 20, 2023

First of all, thanks for all your hard work on this plugin :)

This plugin was recently added to Remix, replacing an older polyfills plugin, but we've found that the calls to polyfillPath and polyfillContent can be quite slow, even on rebuilds. To dramatically improve build performance, this PR introduces a cache for these functions.

Note that the cache stores promises rather than final values because there might be multiple instances of the plugin running at the same time, which is the case in Remix, and we want any subsequent calls to wait on the same operation.

Status and versioning classification:

  • Code changes have been tested and working fine, or there are no code changes

@imranbarbhuiya
Copy link
Owner

imranbarbhuiya commented Jun 20, 2023

Thanks ❤️

released in https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/releases/tag/v1.0.16

@imranbarbhuiya imranbarbhuiya merged commit c71714f into imranbarbhuiya:main Jun 20, 2023
@markdalgleish markdalgleish deleted the cache-polyfills branch June 20, 2023 12:34
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.

2 participants