-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example of building an ejected React app #427
Comments
The https://github.com/aspect-build/bazel-examples/tree/main/react-cra is now ejected with fine grained ts_project transpilation & type checking done before the react-scripts build step. Babel not being used as suggested in https://github.com/bazelbuild/rules_nodejs/blob/stable/docs/examples.md#react but that would be easy to support with the |
Should we still keep an example of react that's not ejected? |
Am I missing something? The example react-cra does not appear to be ejected as it's still using react-scripts rather than the ejected scripts that are generated. |
I "ejected" it in the Bazel sense that it is now using fine grained Ejecting the webpack config is orthogonal to ejecting the transpilation. It could be done relatively easily as well. |
I'll re-open this as a place holder to add an example of an ejected CRA webpack config as well. |
That would be great, I'm currently trying to use the various js_rules to replace some legacy custom rules that were written a while ago and an example with a CRA ejected app would be great. On a tangential topic, I noticed that due to the use of symlinks in the rules/bazel live reload features don't seem to work (due to watchman). Is there a way to get around using symlinked files? |
The |
Hey there, sorry I've been out on holidays. The issue I'm seeing with js_run_devserver is I'm trying to run what is effectively
However, it is complaining that the rule got multiple values for paramter 'entry_point'. Not sure if that's a bug, since the docs seem to indicate it is a valid parameter. |
Ah the thing I also missed is that you need ibazel in order to pick up the changes. I think just using js_binary likely will work with ibazel. |
Ahh. Looks like the doc generation is wrong for that attribute since it is not meant to be set the by the user. The macro looks like this,
User facing API equivalents to entry_point are the rules_webpack has its own |
I'll make an issue for it and also post a better failure message if it gets set by accident by a user. |
That makes sense, thanks for looking into it. I'll try using node as the tool. |
You can pass a js_binary target as the tool. That is where you'll specify your custom entry point. |
If you eject from CRA (react-scripts) you can make something more incremental and bazel-idiomatic.
https://github.com/heartless-clown/bazel_aspect_rules_js_react/blob/ejected/app/react-app/BUILD.bazel#L111-L112 is a start
Also note: we promised this as "react-scripts-like" in https://github.com/bazelbuild/rules_nodejs/blob/stable/docs/examples.md#react
The text was updated successfully, but these errors were encountered: