Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #8813
Closed
Open
Issue created Apr 09, 2020 by Administrator@rootContributor

PUBLIC_URL is not the same as homepage, but only the pathname

Created by: elvisLAI

Describe the bug

I have uploaded all the static resources to CDN, include .js and .css files. So I have to set the 'homepage' as the host address of CDN server, which make the urls of scripts in 'index.html' to be right.

However, the urls injected to 'index.html' is the pathname of 'homepage' that I set in package.json, after upload react-scripts to 3.4.1.

And there is no such problem when I using version 3.3.0. I found that the actual homepage has been change after this PR feat(react-scripts): allow PUBLIC_URL in develoment mode

So I want to know, is it a bug that will be fixed? Or is there any method that can make the PUBLIC_URL to be a complete url.

Did you try recovering your dependencies?

no, but downgrade to 3.3.0

Which terms did you search for in User Guide?

The docs still use the complete url as example Step 1: Add homepage to package.json

Environment

irrelevant, i guess

Steps to reproduce

(Write your steps here:)

  1. set homepage in package.json like 'https://example.com/a/b/c'
  2. yarn build
  3. the url of script in index.html will be '/a/b/c/xxx.js', which will not find the correct resource

Expected behavior

The PUBLIC_URL should be the same as homepage in package.json

Actual behavior

The PUBLIC_URL is the pathname of homepage

Reproducible demo

no demo

Assignee
Assign to
Time tracking