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

Add browser and module field support to package.json processing #2598

Closed
wants to merge 1 commit into from
Closed

Add browser and module field support to package.json processing #2598

wants to merge 1 commit into from

Conversation

anmonteiro
Copy link
Contributor

This PR fixes #2433 by introducing a new option, packageJsonEntryNames, which allows specifying a list of ordered entries which the compiler should look for when resolving Node modules. The default is the single entry "main".

When compiling for the web, however, we would pass in a list of "browser", "main" which tells the compiler to look for a "browser" entry before checking the "main" entry.

This also allows people who want to consume packages that instead rely on es2015:main or esnext:main to include those too in the order of precedence they prefer.

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@anmonteiro
Copy link
Contributor Author

I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

@ChadKillingsworth
Copy link
Collaborator

The PR itself looks good - a flag can be added later for CLI usage.

@anmonteiro Do you have any idea how prevalent the browser field advanced usage form is? https://github.com/defunctzombie/package-browser-field-spec#replace-specific-files---advanced

That's been my largest hangup on this to date.

@Deraen
Copy link
Contributor

Deraen commented Aug 3, 2017

@anmonteiro
Copy link
Contributor Author

Interesting. I didn't know about the advanced usage of the browser field.

I have no idea how prevalent it is, but my intuition would be to solve that as needed.

This PR introduces basic support for it, and we can build on it later.

@ChadKillingsworth
Copy link
Collaborator

@dimvar LGTM. We'll continue to iterate on this in future PRs.

@dimvar
Copy link
Contributor

dimvar commented Aug 3, 2017

OK, I'll import and submit the PR internally.

@dimvar dimvar closed this in 51fe34e Aug 3, 2017
@anmonteiro anmonteiro deleted the gh-2433 branch August 4, 2017 06:02
alexeagle pushed a commit to alexeagle/closure-compiler that referenced this pull request Aug 8, 2017
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.

Add browser and module field support to package.json processing
5 participants