feat: optionally provide empty polyfills#132
Merged
imranbarbhuiya merged 1 commit intoimranbarbhuiya:mainfrom Jul 17, 2023
Merged
feat: optionally provide empty polyfills#132imranbarbhuiya merged 1 commit intoimranbarbhuiya:mainfrom
imranbarbhuiya merged 1 commit intoimranbarbhuiya:mainfrom
Conversation
imranbarbhuiya
approved these changes
Jul 17, 2023
Owner
|
Thanks ❤️, released in https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/releases/tag/v1.3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've been investigating issues some Remix users have had since we migrated from esbuild-plugin-polyfill-node.
One issue is that the
fspolyfill is throwing an error when building for Cloudflare since it sets up a file system watcher as a top-level side effect:What's interesting is this wasn't happening with our old polyfill setup even though it was also built on JSPM browser polyfills. It turns out that previously the
fspolyfill was actually an empty module by default (among others): https://github.com/cyco130/esbuild-plugin-polyfill-node/blob/9afcb6abaf9062a15daaffce9a14e478b365139c/src/index.ts#L143-L149. I can reproduce the same error with our old polyfills if I explicitly enable thefspolyfill.In order to support this scenario, this PR extends the
modulesoption to support an object that can optionally configure empty polyfills, e.g.Status and versioning classification: