ReactJS app published to Github pages with custom domain
Make sure your package.json have the attribute homepage. e.g.
"homepage": "https://<git-USER>.github.io/",
That's literally what I just did with my cra projet. If you want to take a look on my project just look at the develop branch. However, I haven't use gh-pages -d build. I just built the project myself and create the branch gh-pages and put the content of my build into it. It should be the same though.
Adding a copy CNAME script to my package.json
scripts worked for me as it wasn't being published to gh-pages
branch automatically in the React Create App build dir.
"copy": "cp ./CNAME ./build/CNAME","predeploy": "yarn build && yarn copy",