Skip to content

Commit 349dba4

Browse files
taiontimdorr
authored andcommitted
Improve instructions for users of ES modules
1 parent 4c6a834 commit 349dba4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/guides/MinimizingBundleSize.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ The public API available in this manner is defined as the set of imports availab
2828

2929
## Use a Bundler with ES2015 Module Support
3030

31-
React Router offers a ES2015 module build under `es6/` and defines a `jsnext:main` entry point. If you are using a bundler that supports ES2015 modules and tree-shaking such as webpack 2 or Rollup, you can directly import from `react-router`, as long as you are correctly resolving to the ES2015 module build.
31+
React Router offers a ES2015 module build and defines a `jsnext:main` entry point. Only if you are using a bundler that supports ES2015 modules and tree-shaking such as webpack 2 or Rollup, you can directly import from `react-router`, as long as you are correctly resolving to the ES2015 module build. Specifically, in those cases, you can write
32+
33+
```js
34+
import { Link, Route, Router } from 'react-router'
35+
```
36+
37+
Tree-shaking will ensure that only the relevant modules will be included in your bundle.
38+
39+
**Note:** Please do not import from the subdirectory with the ES module build directly. If you are using webpack 2, please add `jsnext:main` to `resolve.mainFields` (or `resolve.packageMains` for older versions of webpack 2).

0 commit comments

Comments
 (0)