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 targets and browserslist* options to @babel/core #12189

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Oct 15, 2020

Q                       A
Fixed Issues? RFC: babel/rfcs#2 <-- Please read and review it!
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link babel/website#2416
Any Dependency Changes?
License MIT

The commits can be reviewed one by one.

  1. The first one introduces { esmodules: "intersect" } to helper-compilation-targets: it can be used to intersect esmodules with the browsers option, rather than overwriting it (fixes The esmodules target should be more future friendly #8809). Note that it cannot be used with @babel/preset-env, and is used by setting esmodules: true in @babel/core. In Babel 8, we'll remove { esmodules: "intersect" } from helper-compilation-target and make it the default behavior for true.
  2. The second one introduces validation and resolution for the new targets, browserslistConfigFile and browserslistEnv option that can be specified in programmatic options and in config files.
  3. The third one passes the resolved targets to presets and plugins.
  4. The fourth one used the new targets in @babel/preset-env.
  5. The fifth commit polyfills api.targets in @babel/helper-plugin-utils, so that we can use it in plugins/presets without worrying about it not being defined.

@nicolo-ribaudo nicolo-ribaudo added pkg: core PR: New Feature 🚀 A type of pull request used for our changelog categories labels Oct 15, 2020
@babel-bot
Copy link
Collaborator

babel-bot commented Oct 15, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/34601/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 15, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b024ab6:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@@ -699,6 +699,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
options.sourceMaps = options.sourceMap;
delete options.sourceMap;
}

This comment was marked as resolved.

mobileToDesktop: true,
env: options.browserslistEnv,
env: options.env ?? options.browserslistEnv,

This comment was marked as resolved.

@JLHwung JLHwung self-requested a review November 19, 2020 17:46
@nicolo-ribaudo nicolo-ribaudo force-pushed the targets-in-core branch 2 times, most recently from 085be04 to 7bb7925 Compare November 27, 2020 16:18
@existentialism existentialism self-assigned this Dec 1, 2020
@nicolo-ribaudo nicolo-ribaudo removed the PR: Needs Review A pull request awaiting more approvals label Dec 10, 2020
@nicolo-ribaudo nicolo-ribaudo merged commit b56d430 into babel:feat-7.13.0/babel-core-features Dec 10, 2020
Nicolò's ideal PR review order list automation moved this from Reviewed to Done Dec 10, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the targets-in-core branch December 10, 2020 12:12
@nicolo-ribaudo
Copy link
Member Author

Merged into #12470

nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Jan 12, 2021
nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Feb 4, 2021
nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Feb 10, 2021
nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Feb 11, 2021
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: core PR: New Feature 🚀 A type of pull request used for our changelog categories
Development

Successfully merging this pull request may close these issues.

The esmodules target should be more future friendly
6 participants