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

fix: Support browser overrides in package.json #424

Merged
merged 5 commits into from
Jun 5, 2024
Merged

Conversation

dvoytenko
Copy link
Member

browser section package.json is used to expand a list of dependent files. The downstream build tool would normally do the right thing and use the browser section for bundling correctly. I tested the bundling itself on esbuild and WebPack, and it works correctly. All that's needed is to make sure the files are there.

@dvoytenko dvoytenko changed the title Support browser overrides in package.json (fix) Support browser overrides in package.json Jun 4, 2024
@dvoytenko dvoytenko changed the title (fix) Support browser overrides in package.json fix: Support browser overrides in package.json Jun 4, 2024
Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

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

This makes sense to me and will be good so we can trace for react-server and other conditions as well

@dvoytenko dvoytenko enabled auto-merge (squash) June 5, 2024 21:02
@dvoytenko dvoytenko merged commit ff4341b into main Jun 5, 2024
10 checks passed
@dvoytenko dvoytenko deleted the dimavoytenko/browser branch June 5, 2024 21:54
Copy link

github-actions bot commented Jun 5, 2024

🎉 This PR is included in version 0.27.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

kodiakhq bot pushed a commit to vercel/vercel that referenced this pull request Jun 6, 2024
kodiakhq bot added a commit that referenced this pull request Jul 11, 2024
…`false` (#427)

We [recently shipped](#424) support
for the `browser` field, but we discovered an edge case where instead of
mapping to another string, the value could be `false` (eg,
[`object-inspect`](https://github.com/inspect-js/object-inspect/blob/main/package.json#L82)),
which indicates that this module should be treated as an empty object
(`{}`) (evidenced by its usage
[here](https://github.com/inspect-js/object-inspect/blob/main/index.js#L68-L70)).

The code was previously erroring on the string's `startsWith` checks,
causing the entire package to be omitted from the file mapping result.
This ensures that if the value is `false` we'll continue on.

---------

Co-authored-by: Steven <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants