Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't mutate InputTarget's passed to @babel/helper-compilation-t…
…argets If `@babel/helper-compilation-targets` is called directly, as it is in the [Ember-CLI babel](https://github.com/babel/ember-cli-babel/blob/6f76f405b9dd2a48cce394c4826dd50847f74282/index.js#L543-L545) and [Vue CLI](https://github.com/vuejs/vue-cli/blob/c8cecffedbf7b19cf930bb2821b5c352bc716a67/packages/%40vue/babel-preset-app/index.js#L17) integrations, we don't want to mutate the input passed in. At least in Ember CLI, babel could be called multiple times. So, on subsequent passes all `browsers` and `esmodules` info would be lost (and losing the `browsers` info affects the output in negative ways). Copying the object before dropping keys allows callers not have to worry about babel mutating the object they pass in. Switching to a more functional approach makes it easier for babel to not worry about what consumers are passing in. Dropping the `browser` property was introduced in: #11500 Dropping the `esmodules` property was introduced in #11124 Discussion about dropping the `esmodules` property: #11124 (comment)
- Loading branch information