I have a react app deployed with git hub pages, using gh-pages plugin. My package.json entry look like this.
"scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build”,
     .....
   }
Eveything worked fine until I tried to use a custom domain.
I configured the required A and CNAME entry in my domain provider DNS settings.
I created the CNAME file in the develop branch. That is the branch that I have checked out on my local machine.
I run npm run deploy on develop branch on local machine.
plugin pushed the build code to gh-pages branch on remote.
the gh-pages branch on remote does not contain the CNAME file.
after every deploy I have to manually add the custom-domain from github settings pages section, which eventually create a CNAME file. And then every works.
Is there a configuration requied in package.json to force gh-pages plugin to copy the CNAME file ?
As stated in the docs, you're just missing the --cname argument:
gh-pages -d build --cname custom-domain.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With