You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a basic example at [examples/react_webpack](https://github.com/bazelbuild/rules_nodejs/tree/master/examples/react_webpack)
28
+
Similar to the explanation above for Angular, Bazel is agnostic to what tools you choose to run on your project.
29
+
However, the benefits of using Bazel are unlocked as you adopt it as your build system.
30
+
We think the following examples show a typical migration of adopting Bazel:
29
31
30
-
We are likely to add more, as the rules_nodejs core maintainers are working on some React projects.
32
+
**create-react-app**: If you run `create-react-app`, it will install a build system called `react-scripts`.
33
+
As a first step into Bazel, you can simply ask Bazel to wrap the existing build system.
34
+
This guarantees compatibility with your current code, and if your objective is just to include a frontend app into
35
+
a bigger full-stack Bazel build, this might be the final step in the migration.
36
+
However it will run `react-scripts` as a single Bazel action, which means that you gain no incrementality benefit.
37
+
So we expect for most applications this is just a first step.
38
+
39
+
The [create-react-app example](https://github.com/bazelbuild/rules_nodejs/tree/master/examples/create-react-app)
40
+
shows how this will look. We suggest reading the README in that example, and also look at the commit history to that
41
+
directory as an illustration of how we started from create-react-app and added Bazel bits.
42
+
43
+
**cra-eject**: As a next step to make our Build more incremental and performant, we follow the create-react-app suggestion
44
+
of "ejecting" the configuration. This means the `react-scripts` build system is gone, and Bazel can take its place.
45
+
46
+
TODO(alexeagle): build an example illustrating how this looks
47
+
48
+
**custom**: If you really know your JS build tools, Bazel is the perfect way to assemble all the myriad individual tools
49
+
into a custom toolchain. This allows you to unlock any part of the JS ecosystem without waiting for it to be integrated
50
+
for you by maintainers of a project like create-react-app, who have a very high bar for adding features since the
51
+
maintenance and support burden falls on them. However you'll need to understand both the tools as well as Bazel to
52
+
successfully build your own toolchain.
53
+
54
+
There is a basic example at [examples/react_webpack](https://github.com/bazelbuild/rules_nodejs/tree/master/examples/react_webpack) but it needs a lot more work to show everything that is possible!
Copy file name to clipboardExpand all lines: examples/create-react-app/README.md
+4-15Lines changed: 4 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
1
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2
+
Then Bazel configuration was added in `WORKSPACE` and `BUILD.bazel`
3
+
4
+
See the [examples guide](https://bazelbuild.github.io/rules_nodejs/examples#react) for a comparison of the several
5
+
approaches you can take to build and test your React app with Bazel.
2
6
3
7
## Available Scripts
4
8
@@ -27,18 +31,3 @@ Your app is ready to be deployed!
27
31
28
32
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29
33
30
-
### `yarn eject`
31
-
32
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33
-
34
-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35
-
36
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37
-
38
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39
-
40
-
## Learn More
41
-
42
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43
-
44
-
To learn React, check out the [React documentation](https://reactjs.org/).
0 commit comments