Skip to content

Upgrading react-scripts from 3.2.0 to 3.4.0 will cause routing URL behave differently when "homepage" is set in Dev mode #8519

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

Closed
tkforce opened this issue Feb 20, 2020 · 5 comments

Comments

@tkforce
Copy link

tkforce commented Feb 20, 2020

Describe the bug

Upgrading react-scripts from 3.2.0 to 3.4.0 will cause routing URL behave differently when "homepage" is set in Dev mode.

With hompage:"/my/dir" set in my package.json and using React router component <Link to="/about">About</Link> to do the routing, different version will have different behavior on the url generated in <a href="xxx"> :

v3.2.0 -> <a href="https://github.com/about">
v3.4.0 -> <a href="https://github.com/my/dir/about">

But it seems to be only affecting dev version of the application, production build is always pointing to <a href="https://github.com/my/dir/about">

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

homepage, react-scripts, 3.4.0, change log

Environment

(paste the output of the command here.)

Steps to reproduce

(Write your steps here:)

  1. install react-scripts 3.2.0
  2. set homepage:"/my/dir" in package.json
  3. add <Link to="/about">About</Link> from react-router to the project
  4. npm start
  5. inspect this element in browser, it will have different href in different react-scripts version
    v3.2.0 -> <a href="https://github.com/about">
    v3.4.0 -> <a href="https://github.com/my/dir/about">

Expected behavior

Should behave the same as the previous version.

Actual behavior

Inspect this element in browser, it will have different href in different react-scripts version
v3.2.0 -> <a href="https://github.com/about">
v3.4.0 -> <a href="https://github.com/my/dir/about">

Reproducible demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@mbochynski
Copy link

This change was made on purpose. You can check details here: #7259 So probably you will need to change your config. The change broke my setup too. For me setting PUBLIC_URL by hand in dev and during the build make the job.

@jamesplease
Copy link

This comment may help you @tkforce

@tkforce
Copy link
Author

tkforce commented Feb 23, 2020

@jamesplease Thanks for explaining this issue in detail, really appreciate!

In my cases we only use homepage rather then PUBLIC_URL, do you mind elaborate the difference between them and when to use which (I did read through docs but still not quit fully understood)?

My observation is that with homepage:/my-app in v3.4.0, at lease url in dev and prod is aligned without any extra manipulation.
DEV: localhost:3000/my-app/xxx
PROD: some-public-domain.com/my-app/xxx

while in v3.3.2
DEV: localhost:3000/xxx
PROD: some-public-domain.com/my-app/xxx

helloworld added a commit to dagster-io/dagster that referenced this issue Feb 25, 2020
Summary:
Loading dagit would cause the following error:

```
The "path" argument must be of type string. Received undefined
```

This was an issue in `react-scripts`. Upgrading to 3.4.0 resolves the error

Context:
facebook/create-react-app#8490
facebook/create-react-app#8519

Test Plan: `yarn install`, run dagit

Reviewers: prha, alangenfeld, catherinewu, schrockn

Reviewed By: prha, schrockn

Subscribers: schrockn

Differential Revision: https://dagster.phacility.com/D2111
@stale
Copy link

stale bot commented Mar 24, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Mar 24, 2020
@stale
Copy link

stale bot commented Mar 29, 2020

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Mar 29, 2020
@lock lock bot locked and limited conversation to collaborators Apr 4, 2020
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

3 participants