Skip to content
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

Is there any way to set homepage outside of package.json? #1435

Closed
JasonKDarby opened this issue Jan 24, 2017 · 7 comments
Closed

Is there any way to set homepage outside of package.json? #1435

JasonKDarby opened this issue Jan 24, 2017 · 7 comments
Milestone

Comments

@JasonKDarby
Copy link

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!

@gaearon
Copy link
Contributor

gaearon commented Jan 24, 2017

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

@JasonKDarby
Copy link
Author

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.

@viankakrisna
Copy link
Contributor

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

@JasonKDarby
Copy link
Author

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.

@bshields-idatainc
Copy link

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 <iframe src="/extensions/myapp-1.2.3/index.html"> in the main app. We are currently doing this "the hard way" - loading babel.js, react.js, etc. and transpiling in the browser, which has many performance and functionality limitations such as difficulty using any 3rd-party react/js libraries. I would like to switch to CRA-based development, but I'm having issues merging this into our build and deployment processes.

I am also looking for the same capability for the package.json "version" variable, but that may be a topic for a different discussion...]

@gaearon
Copy link
Contributor

gaearon commented Feb 4, 2017

I think #937 might solve this.

@Timer
Copy link
Contributor

Timer commented Feb 11, 2017

Hi there! react-scripts v0.9.0 was just released which adds support for specifying a url. You may read how to configure it here.

Please test it and don't hesitate to reach out if this doesn't solve your specific use case!

@Timer Timer closed this as completed Feb 11, 2017
@Timer Timer added this to the 0.9.0 milestone Feb 11, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants