Create-react-app: Is there any way to set homepage outside of package.json?

Created on 24 Jan 2017  路  7Comments  路  Source: facebook/create-react-app

I'm not familiar enough with npm or any part of the build to be certain that there isn't a way to already, but I can't find documentation for it if it is possible.

Basically, I want to be able to configure homepage in a file not under source control (or passed as a cli argument or environment variable or what have you) so that if somebody forks the project they aren't needing to use my homepage and aren't getting conflicts if they're keeping up with active development.

Thanks!

proposal

Most helpful comment

I think #937 might solve this.

All 7 comments

This is not currently supported. Why would they get conflicts though? If it鈥檚 a single line change they should be able to merge any other changes without conflicts (unless you will change your URL again).

I guess I mean if they intend to merge updates back into my repo then they have to revert their homepage change, get it merged into mine, then change their homepage back. If all changes are from me to them then yeah there's no issue but if they're proposing changes in my direction hopefully you see where I'm coming from.

Why do you need to change the homepage for development? I think homepage is for production build. Don't see why it should / would be changed with every developer who collaborating because we serve the development build on localhost:3000 or anything based on your current HOST and PORT env variable

In our case we are deploying to github pages outside of an organization, so it doesn't make sense for my bud's repo to deploy to my pages. I understand that it obviously fits in an organization type setup where there's a clear, single homepage for the project, but that's just not how we were planning to use it at the moment.

I understand if you don't see my use case as worth supporting, or if you want to say we should have a more typical workflow. There are certainly workarounds to it as well, we can always just swap the homepage back on branches that are agreed to be merged. I just thought there's probably a way to do it that's less hacky (or doesn't require ejecting) but clearly you can just propose that create-react-app isn't meant to be super flexible, it's meant to have sensible defaults.

I'm looking for a similar capability for a different use case: in our "versioned" production environment, the homepage value requires a version number appended to the end of it. E.g.: "/extensions/myapp-1.2.3" for a React app named "myapp". I would like a method to set this value either from a file (like .env) or from an environment variable.

[Additional details: my React apps are essentially controlled "plug-ins" that are loaded via a dynamically generated