Update more scope package refs in preset-env docs [skip ci]

This commit is contained in:
Brian Ng 2017-10-18 09:51:35 -05:00 committed by GitHub
parent 72d1a72122
commit c23281dc54

View File

@ -3,10 +3,10 @@
> A Babel preset that compiles [ES2015+](https://github.com/tc39/proposals/blob/master/finished-proposals.md) down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments.
```sh
npm install babel-preset-env --save-dev
npm install @babel/preset-env --save-dev
```
Without any configuration options, babel-preset-env behaves exactly the same as babel-preset-latest (or babel-preset-es2015, babel-preset-es2016, and babel-preset-es2017 together).
Without any configuration options, @babel/preset-env behaves exactly the same as @babel/preset-latest (or @babel/preset-es2015, @babel/preset-es2016, and @babel/preset-es2017 together).
```json
{
@ -85,9 +85,9 @@ This should be straightforward to do in most cases. There might be cases where p
### Support all plugins in Babel that are considered `latest`
> Default behavior without options is the same as `babel-preset-latest`.
> Default behavior without options is the same as `@babel/preset-latest`.
It won't include `stage-x` plugins. env will support all plugins in what we consider the latest version of JavaScript (by matching what we do in [`babel-preset-latest`](http://babeljs.io/docs/plugins/preset-latest/)).
It won't include `stage-x` plugins. env will support all plugins in what we consider the latest version of JavaScript (by matching what we do in [`@babel/preset-latest`](http://babeljs.io/docs/plugins/preset-latest/)).
Ref: [#14](https://github.com/babel/babel-preset-env/issues/14)
@ -109,7 +109,7 @@ Ref: [#19](https://github.com/babel/babel-preset-env/pull/19)
[Browserslist](https://github.com/ai/browserslist) is a library used to share a supported list of browsers between different front-end tools like [autoprefixer](https://github.com/postcss/autoprefixer), [stylelint](https://stylelint.io/), [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) and many others.
By default, babel-preset-env will use [browserslist config sources](https://github.com/ai/browserslist#queries).
By default, @babel/preset-env will use [browserslist config sources](https://github.com/ai/browserslist#queries).
For example, to enable only the polyfills and plugins needed for a project targeting *last 2 versions* and *IE10*:
@ -152,18 +152,18 @@ Browserslist config will be ignored if: 1) `targets.browsers` was specified 2) o
With [npm](https://www.npmjs.com):
```sh
npm install --save-dev babel-preset-env
npm install --save-dev @babel/preset-env
```
Or [yarn](https://yarnpkg.com):
```sh
yarn add babel-preset-env --dev
yarn add @babel/preset-env --dev
```
## Usage
The default behavior without options runs all transforms (behaves the same as [babel-preset-latest](https://babeljs.io/docs/plugins/preset-latest/)).
The default behavior without options runs all transforms (behaves the same as [@babel/preset-latest](https://babeljs.io/docs/plugins/preset-latest/)).
```json
{
@ -235,7 +235,7 @@ An array of plugins to always include.
Valid options include any:
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) - both with (`babel-plugin-transform-es2015-spread`) and without prefix (`transform-es2015-spread`) are supported.
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) - both with (`@babel/plugin-transform-es2015-spread`) and without prefix (`transform-es2015-spread`) are supported.
- [Built-ins](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js), such as `map`, `set`, or `object.assign`.
@ -259,7 +259,7 @@ This option is useful for "blacklisting" a transform like `transform-regenerator
`"usage"` | `"entry"` | `false`, defaults to `false`.
A way to apply `babel-preset-env` for polyfills (via `babel-polyfill`).
A way to apply `@babel/preset-env` for polyfills (via `babel-polyfill`).
```sh
npm install babel-polyfill --save
@ -308,10 +308,10 @@ var b = new Map();
#### `useBuiltIns: 'entry'`
> NOTE: Only use `require("@babel/polyfill");` once in your whole app.
> Multiple imports or requires of `babel-polyfill` will throw an error since it can cause global collisions and other issues that are hard to trace.
> Multiple imports or requires of `@babel/polyfill` will throw an error since it can cause global collisions and other issues that are hard to trace.
> We recommend creating a single entry file that only contains the `require` statement.
This option enables a new plugin that replaces the statement `import "@babel/polyfill"` or `require("@babel/polyfill")` with individual requires for `babel-polyfill` based on environment.
This option enables a new plugin that replaces the statement `import "@babel/polyfill"` or `require("@babel/polyfill")` with individual requires for `@babel/polyfill` based on environment.
**In**
@ -387,7 +387,7 @@ Toggles whether or not [browserslist config sources](https://github.com/ai/brows
`boolean`, defaults to `false`
Toggles enabling support for builtin/feature proposals that have shipped in browsers. If your target environments have native support for a feature proposal, its matching parser syntax plugin is enabled instead of performing any transform. Note that this _does not_ enable the same transformations as [`babel-preset-stage3`](https://babeljs.io/docs/plugins/preset-stage-3/), since proposals can continue to change before landing in browsers.
Toggles enabling support for builtin/feature proposals that have shipped in browsers. If your target environments have native support for a feature proposal, its matching parser syntax plugin is enabled instead of performing any transform. Note that this _does not_ enable the same transformations as [`@babel/preset-stage3`](https://babeljs.io/docs/plugins/preset-stage-3/), since proposals can continue to change before landing in browsers.
The following are currently supported: