Browse Source

Update building instructions

main
Dan Abramov 5 years ago
committed by GitHub
parent
commit
b3c7540a10
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      content/docs/how-to-contribute.md

16
content/docs/how-to-contribute.md

@ -130,19 +130,27 @@ First, run `yarn build`. This will produce pre-built bundles in `build` folder,
The easiest way to try your changes is to run `yarn build react/index,react-dom/index --type=UMD` and then open `fixtures/packaging/babel-standalone/dev.html`. This file already uses `react.development.js` from the `build` folder so it will pick up your changes. The easiest way to try your changes is to run `yarn build react/index,react-dom/index --type=UMD` and then open `fixtures/packaging/babel-standalone/dev.html`. This file already uses `react.development.js` from the `build` folder so it will pick up your changes.
If you want to try your changes in your existing React project, you may copy `build/dist/react.development.js`, `build/dist/react-dom.development.js`, or any other build products into your app and use them instead of the stable version. If your project uses React from npm, you may delete `react` and `react-dom` in its dependencies and use `yarn link` to point them to your local `build` folder: If you want to try your changes in your existing React project, you may copy `build/dist/react.development.js`, `build/dist/react-dom.development.js`, or any other build products into your app and use them instead of the stable version.
If your project uses React from npm, you may delete `react` and `react-dom` in its dependencies and use `yarn link` to point them to your local `build` folder. Note that **instead of `--type=UMD` you'll want to pass `--type=NODE` when building**. You'll also need to build the `scheduler` package:
```sh ```sh
cd ~/path_to_your_react_clone/build/node_modules/react cd ~/path_to_your_react_clone/
yarn build react/index,react-dom/index,scheduler --type=NODE
cd build/node_modules/react
yarn link yarn link
cd ~/path_to_your_react_clone/build/node_modules/react-dom cd build/node_modules/react-dom
yarn link yarn link
cd /path/to/your/project
cd ~/path/to/your/project
yarn link react react-dom yarn link react react-dom
``` ```
Every time you run `yarn build` in the React folder, the updated versions will appear in your project's `node_modules`. You can then rebuild your project to try your changes. Every time you run `yarn build` in the React folder, the updated versions will appear in your project's `node_modules`. You can then rebuild your project to try your changes.
If some package is still missing (e.g. maybe you use `react-dom/server` in your project), you can always do a full build with `yarn build`. Note that running `yarn build` without options takes a long time.
We still require that your pull request contains unit tests for any new functionality. This way we can ensure that we don't break your code in the future. We still require that your pull request contains unit tests for any new functionality. This way we can ensure that we don't break your code in the future.
### Style Guide {#style-guide} ### Style Guide {#style-guide}

Loading…
Cancel
Save