-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Setting homepage in package.json doesn't set PUBLIC_URL on build #2575
Comments
This is functioning correctly. Only the path of the URL is interpolated into Would you like to send an update to the docs to clarify this? |
@glennreyes Also, is there a particular reason you want it to work like this instead of how it works now? |
Thanks! Makes sense to just inject the path. It's also already very clear in the docs. @heyimalex No, I actually prefer how it is right now. That said, I will close this issue. |
@Timer if this is the correct use of public_url what is the correct way of setting full URL for the meta tags that require it such as og:image? |
… as your homepage x)
People like me who are looking for something like this in in build:
1. Quick SolutionBuild your project like this:
(linux)
(mac) And you will get
in your built index.html 2. Permanent SolutionCreate a file called
Build your project as usual (
3. Weird SolutionAdd this in your package.json
Then index.html will be generated with:
Which is basically the same as:
in my understanding. |
Description
Following the docs here (Building for Relative Paths), so setting
homepage
field inpackage.json
doesn't set PUBLIC_URL during the build.Expected behavior
%PUBLIC_URL%
inbuild/index.html
should be replaced with URL set in package.json'shomepage
field.package.json:
build/index.html:
Actual behavior
%PUBLIC_URL%
will be replaced with nothing.package.json:
build/index.html:
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): 1.0.7node -v
: 8.1.2npm -v
: 5.0.3Then, specify:
Reproducible Demo
create-react-app my-app
(I used create-react-app 1.3.1)cd my-app
"homepage": "https://example.com"
to package.jsonyarn build
build/index.html
doesn't prepend URL to the paths in the script tagBut setting
PUBLIC_URL=https://example.com
in.env
and build will produce the expected behaviour (adds URL to the script tag). Settinghomepage
in package.json should do the same.The text was updated successfully, but these errors were encountered: