question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to access the homepage /path from within the app?

See original GitHub issue

In the documentation it says to use the ‘homepage’ property in package.json to produce builds that are not mounted at the server root.

How do I access the pathname portion of this property in the application? I need to use it, for instance, inside <Route> declaration:

<Route path={?homepage.path?} .... />

Similarly, when interacting with react-router’s functions, I need to access it. I’d like this to be DRY. Thank you.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
godmarcommented, Oct 27, 2016

No thank you.

I don’t have your repo cloned, and submitting a PR for a 1 sentence change means at least 3 min of work for me when it would mean 30s of work for you. Also, I don’t want to sign the facebook contributor agreement, and in general I feel I’m doing enough (without pay) for FB here by helping to debug and improve your product, and, more importantly, by teaching it to students. Or at least trying to, given the constraint that a 30 day old version fails documented functionality 😉

On a technical note, I don’t understand why a project “homepage” is the same as the production build deployment target. You probably shouldn’t be using the “homepage” property for this (?)

4reactions
gaearoncommented, Oct 28, 2016

I don’t have your repo cloned

You can edit documentation on GitHub.

Also, I don’t want to sign the facebook contributor agreement

This project has no CLA as far as I know.

in general I feel I’m doing enough (without pay) for FB here by helping to debug and improve your product, and, more importantly, by teaching it to students

It’s your call, sure. I do appreciate your work. As you can imagine, I also have a ton of other issues to take care of including in React itself, and this project is largely driven by community contributions.

You probably shouldn’t be using the “homepage” property for this (?)

For now, that ship has sailed. We could change it at some point when we introduce our own configuration format but we’ve been avoiding decisions about it for now. I think we may introduce optional streamlined configuration in several months, and then we’ll consider making it more explicit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How is it possible to access homepage from package.json in a ...
create .env file in the root of your project. add REACT_APP_HOME_PAGE='/example-path/' to the .env file.
Read more >
app-root-path - npm
Determine an app's root path from anywhere inside the app. ... Start using app-root-path in your project by running `npm i app-root-path`.
Read more >
Storing and Searching for Application Files - IBI
APP PATH is a list of subdirectories beneath a common parent directory called the Application Root directory (APPROOT). APP PATH is the default...
Read more >
The Art of Routing in Flask - Hackers and Slackers
Flask's "Hello world" example defines a route listening at the root our app and executes a view function called home() : from flask...
Read more >
Configure apps - Azure App Service - Microsoft Learn
NET Core developers, setting app settings in App Service are like setting ... Use the path D:\home\site\wwwroot to refer to your app's root...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found