Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
add undefined import tip to guide
Browse files Browse the repository at this point in the history
Add troubleshooting tip for importing the default export in TypeScript.

Easy mistake to make when migrating from JavaScript.
  • Loading branch information
bagilevi committed Jul 13, 2018
1 parent e4b1f94 commit dc4e448
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/react-scripts/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
- [`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku)
- [`npm run build` fails to minify](#npm-run-build-fails-to-minify)
- [Moment.js locales are missing](#momentjs-locales-are-missing)
- [TypeError: Cannot read property _foo_ on undefined](#typeerror-cannot-read-property-foo-on-undefined)
- [Alternatives to Ejecting](#alternatives-to-ejecting)
- [Something Missing?](#something-missing)

Expand Down Expand Up @@ -2439,6 +2440,20 @@ To resolve this:
In the future, we might start automatically compiling incompatible third-party modules, but it is not currently supported. This approach would also slow down the production builds.
### TypeError: Cannot read property _foo_ on undefined
When importing a module, you might need to use
```typescript
import * as foo from 'foo';
```
instead of
```typescript
import foo from 'foo';
```
## Alternatives to Ejecting
[Ejecting](#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to *fork* `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebookincubator/create-react-app/issues/682).
Expand Down

0 comments on commit dc4e448

Please sign in to comment.