Skip to content

Commit

Permalink
Update minify instructions (facebook#5105)
Browse files Browse the repository at this point in the history
* changed to Migrate to v2.x

* richer explanation

* Update README.md
  • Loading branch information
sag1v authored and Timer committed Sep 26, 2018
1 parent 7e0b501 commit 04a5c34
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2406,20 +2406,9 @@ This will only work for locales that have been explicitly imported before.
### `npm run build` fails to minify
Some third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.
Starting in Create React App v2, we now compile all ES.Next features found in `node_modules`. This means you can consume packages and not worry about them being syntax-incompatible with any browser.
<br>
To resolve this:
1. Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
- Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the `module` field in `package.json`. Note that **even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers**.
2. Fork the package and publish a corrected version yourself.
3. If the dependency is small enough, copy it to your `src/` folder and treat it as application code.
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.
If you're seeing this error, you're likely using an old version of `react-scripts` and need to upgrade to `react-scripts@>=2.0.0`.
## Alternatives to Ejecting
Expand Down

0 comments on commit 04a5c34

Please sign in to comment.