Skip to content

Commit

Permalink
docs: add es2015 code usage notes in installation guide (#6637)
Browse files Browse the repository at this point in the history
Documentation to describe how to leverage the ES2015 export condition feature in 7.4.0 and introduced via 268777b has been added to the installation guide.
  • Loading branch information
clydin committed Nov 16, 2021
1 parent ecbc6c1 commit c2b3e88
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs_app/content/guide/installation.md
Expand Up @@ -2,12 +2,23 @@

Here are different ways you can install RxJS:

## ES6 via npm
## ES2015 via npm

```js
npm install rxjs
```

By default, RxJS 7.x will provide different variants of the code based on the consumer:
* When RxJS 7.x is used on Node.js regardless of whether it is consumed via `require` or `import`, CommonJS code targetting ES5 will be provided for execution.
* When RxJS 7.4+ is used via a bundler targeting a browser (or other non-Node.js platform) ES module code targetting ES5 will be provided by default with the option to use ES2015 code.
7.x versions prior to 7.4.0 will only provide ES5 code.

If the target browsers for a project support ES2015+ or the bundle process supports down-leveling to ES5 then the bundler can optionally be configured to allow the ES2015 RxJS code to be used instead.
You can enable support for using the ES2015 RxJS code by configuring a bundler to use the `es2015` custom export condition during module resolution.
Configuring a bundler to use the `es2015` custom export condition is specific to each bundler.
If you are interested in using this option, please consult the documentation of your bundler for additional information.
However, some general information can be found here: https://webpack.js.org/guides/package-exports/#conditions-custom

To import only what you need:

```ts
Expand Down

0 comments on commit c2b3e88

Please sign in to comment.