Skip to content

fix: support package.json browser field#150

Merged
imranbarbhuiya merged 2 commits intoimranbarbhuiya:mainfrom
markdalgleish:package-browser-field
Aug 23, 2023
Merged

fix: support package.json browser field#150
imranbarbhuiya merged 2 commits intoimranbarbhuiya:mainfrom
markdalgleish:package-browser-field

Conversation

@markdalgleish
Copy link
Contributor

@markdalgleish markdalgleish commented Aug 23, 2023

We had an issue raised against Remix (remix-run/remix#7095) where a dependency used the browser field in package.json to omit the crypto polyfill from browser builds but the polyfill was still being included. This is particularly important in this case because the polyfill is quite large. However, even though esbuild natively supports the browser field, this plugin's resolver is being given a higher priority. This PR adds a check for the browser field and returns an empty module if it's false, or bails out of resolving the polyfill if a file path is detected.

Status and versioning classification:

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

@imranbarbhuiya imranbarbhuiya merged commit 6e84c9b into imranbarbhuiya:main Aug 23, 2023
@markdalgleish markdalgleish deleted the package-browser-field branch August 23, 2023 21:00
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