{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/9161","repository_url":"https://api.github.com/repos/babel/babel","labels_url":"https://api.github.com/repos/babel/babel/issues/9161/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/9161/comments","events_url":"https://api.github.com/repos/babel/babel/issues/9161/events","html_url":"https://github.com/babel/babel/pull/9161","id":389698771,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3NjI4NTM5","number":9161,"title":"[Preset-Env] Pass babel api.env() to browserslist to allow custom env settings","user":{"login":"swernerx","id":145201,"node_id":"MDQ6VXNlcjE0NTIwMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/145201?v=4","gravatar_id":"","url":"https://api.github.com/users/swernerx","html_url":"https://github.com/swernerx","followers_url":"https://api.github.com/users/swernerx/followers","following_url":"https://api.github.com/users/swernerx/following{/other_user}","gists_url":"https://api.github.com/users/swernerx/gists{/gist_id}","starred_url":"https://api.github.com/users/swernerx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swernerx/subscriptions","organizations_url":"https://api.github.com/users/swernerx/orgs","repos_url":"https://api.github.com/users/swernerx/repos","events_url":"https://api.github.com/users/swernerx/events{/privacy}","received_events_url":"https://api.github.com/users/swernerx/received_events","type":"User","site_admin":false},"labels":[{"id":311566482,"node_id":"MDU6TGFiZWwzMTE1NjY0ODI=","url":"https://api.github.com/repos/babel/babel/labels/PR:%20New%20Feature%20:rocket:","name":"PR: New Feature :rocket:","color":"fbca04","default":false},{"id":711879390,"node_id":"MDU6TGFiZWw3MTE4NzkzOTA=","url":"https://api.github.com/repos/babel/babel/labels/pkg:%20preset-env","name":"pkg: preset-env","color":"c2e0c6","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2018-12-11T10:39:51Z","updated_at":"2018-12-20T21:48:16Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/babel/babel/pulls/9161","html_url":"https://github.com/babel/babel/pull/9161","diff_url":"https://github.com/babel/babel/pull/9161.diff","patch_url":"https://github.com/babel/babel/pull/9161.patch"},"body":"...passing through the whole Babel infrastructure. This is useful for SSR and multi browser builds. Fixes: https://github.com/babel/babel/issues/8834\r\n\r\n<!--\r\nBefore making a PR, please read our contributing guidelines\r\nhttps://github.com/babel/babel/blob/master/CONTRIBUTING.md\r\n\r\nFor issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)\r\n\r\nIf you are making a change that should have a docs update: submit another PR to https://github.com/babel/website\r\n-->\r\n\r\n| Q                        | A <!--(Can use an emoji 👍) -->\r\n| ------------------------ | ---\r\n| Fixed Issues?            | Fixes #8834\r\n| Patch: Bug Fix?          | Yes\r\n| Major: Breaking Change?  | No (for most users I figure)\r\n| Tests Added + Pass?      | Yes\r\n| Documentation PR Link    | <!-- If only readme change, add `[skip ci]` to your commits -->\r\n| Any Dependency Changes?  | No\r\n| License                  | MIT\r\n\r\n<!-- Describe your changes below in as much detail as possible -->\r\n\r\nPreviously we were not able to select an environment for `browserslist` when using parallel compilation like e.g. in Webpack with its multi-compiler infrastructure. Setting `BROWSERSLIST_ENV` is not actually feasible as it changes a global runtime specific settings and might break through the boundaries of the current Babel transpilation. What is more elegant - and I would think right - is to pass the environment which is used by Babel itself, which is received via `api.env()` to `browserslist` `env` option. This allows us to use Webpack `babel-loader` `envName` passing to Babel, which is available in `preset-env` and passed to `browserslist`. \r\n\r\nThis feature is often needed when doing multi target builds e.g. legacy and modern browsers, NodeJS and browser builds (for a library or SSR app), etc."},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/449146178","html_url":"https://github.com/babel/babel/pull/9161#issuecomment-449146178","issue_url":"https://api.github.com/repos/babel/babel/issues/9161","id":449146178,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTE0NjE3OA==","user":{"login":"serwer-WittGruppe","id":43369125,"node_id":"MDQ6VXNlcjQzMzY5MTI1","avatar_url":"https://avatars3.githubusercontent.com/u/43369125?v=4","gravatar_id":"","url":"https://api.github.com/users/serwer-WittGruppe","html_url":"https://github.com/serwer-WittGruppe","followers_url":"https://api.github.com/users/serwer-WittGruppe/followers","following_url":"https://api.github.com/users/serwer-WittGruppe/following{/other_user}","gists_url":"https://api.github.com/users/serwer-WittGruppe/gists{/gist_id}","starred_url":"https://api.github.com/users/serwer-WittGruppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serwer-WittGruppe/subscriptions","organizations_url":"https://api.github.com/users/serwer-WittGruppe/orgs","repos_url":"https://api.github.com/users/serwer-WittGruppe/repos","events_url":"https://api.github.com/users/serwer-WittGruppe/events{/privacy}","received_events_url":"https://api.github.com/users/serwer-WittGruppe/received_events","type":"User","site_admin":false},"created_at":"2018-12-20T21:48:16Z","updated_at":"2018-12-20T21:48:16Z","author_association":"NONE","body":"I implemented the suggested changes:\r\n\r\n- Added a new option `forwardEnv` which passes the value of `BABEL_ENV` to `browserslist`. It's a simple boolean value which is `false` by default.\r\n- Added a fixture test which showcases the new functionality.\r\n- No old tests where broken.\r\n- The new tests produce different outputs based on the configuration in the new root `.browserslistrc` file."}}
{"actor":{"display_login":"serwer-WittGruppe"}}