The purpose of this repo is to demonstrate an issue I'm having with Bazel and an ejected create-react-app
project.
When a create-react-app
project is ejected, config/
and scripts/
directories are created and filled with files. You will notice that the build
script in package.json
looks like this: node scripts/build.js
. If you run yarn build
, then you will see that a build/
directory is created in the source root and that it is filled with output files.
-
I added
WORKSPACE
andBUILD.bazel
files and set everything up to build correctly with Bazel. -
If you run
git checkout 5517901ab51bf4110aa1c50049b358fd6957048e && yarn bazelisk clean && yarn bazelisk run //:build
, you will notice that thescripts/build.js
is executed by Bazel. However, instead of outputting abuild/
directory in the source root, it outputs abuild/
directory here:bazel-bin/build.sh.runfiles/create-react-app-ejected-bazel/build
. -
If you run
git checkout 217ff3953df9ee09929717ef0ee8e30713671c37 && yarn bazelisk clean && yarn bazelisk build //:bundle
, you will notice that everything builds correctly and outputs tobazel-bin/bundle/
as expected.
If you run git checkout c6a4e62053d3d4fd3c294752e3a19d2be7556484 && yarn bazelisk clean && yarn bazelisk build //project:bundle
, you will notice that it doesn't build. I can't figure it out. I've tried to get this working for days.
I expect it to output bazel-bin/project/bundle/
full of output files.