Skip to content

Commit af77fa3

Browse files
committed
Renames the configuration prop for async components to .
1 parent 2f315ab commit af77fa3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ The asynchronous component factory. Config goes in, an asynchronous component co
130130
- `LoadingComponent` (_Component_, Optional, default: `null`) : A Component that will be displayed until your async Component is resolved. All props will be passed to it.
131131
- `ErrorComponent` (_Component_, Optional, default: `null`) : A Component that will be displayed if any error occurred whilst trying to resolve your component. All props will be passed to it as well as an `error` prop which is an object with a `message` and `stack` property.
132132
- `name` (_String_, Optional, default: `'AsyncComponent'`) : Use this if you would like to name the created async Component, which helps when firing up the React Dev Tools for example.
133-
- `es6Aware` (_Boolean_, Optional, default: `true`) : Especially useful if you are resolving ES2015 modules. The resolved module will be checked to see if it has a `.default` and if so then the value attached to `.default` will be used.
133+
- `autoResolveES2015Default` (_Boolean_, Optional, default: `true`) : Especially useful if you are resolving ES2015 modules. The resolved module will be checked to see if it has a `.default` and if so then the value attached to `.default` will be used. So easy to forget to do that. 😀
134134
- `ssrMode` (_Boolean_, Optional, default: `'render'`) : Only applies for server side rendering applications. Please see the documentation on server side rendering. The following values are allowed.
135135
- __`'render'`__ - Your asynchronous component will be resolved and rendered on the server. It's children will
136136
be checked to see if there are any nested asynchronous component instances, which will then be processed based on the `ssrMode` value that was associated with them.

src/asyncComponent.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function asyncComponent(args) {
66
const {
77
name,
88
resolve,
9-
es6Aware = true,
9+
autoResolveES2015Default = true,
1010
ssrMode = 'render',
1111
LoadingComponent,
1212
ErrorComponent,
@@ -21,9 +21,11 @@ function asyncComponent(args) {
2121
// Takes the given module and if it has a ".default" the ".default" will
2222
// be returned. i.e. handy when you could be dealing with es6 imports.
2323
const es6Resolve = x =>
24-
es6Aware &&
24+
autoResolveES2015Default &&
2525
(typeof x === 'function' || typeof x === 'object') &&
26-
typeof x.default !== 'undefined'
26+
// eslint-disable-next-line no-underscore-dangle
27+
x.__esModule &&
28+
x.default
2729
? x.default
2830
: x
2931

0 commit comments

Comments
 (0)