create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Media URLs are incorrect in CSS

Open boonware opened this issue 2 years ago • 2 comments

Describe the bug

I am serving my app under a path such as https://my-site.com/somePath. When running a build I set the variable PUBLIC_URL=somePath, and I have also set <base url="%PUBLIC_URL%" /> in index.html . This correctly updates the output files with the correct paths, except for URLs in the CSS, for example:

https://my-site.com/somePath/static/css/somePath/static/media/some-font.woff2

As you can see the CSS URL is incorrect and is not referencing the media directory relative to the CSS file.

Did you try recovering your dependencies?

Yes, and likely not applicable.

Which terms did you search for in User Guide?

Webpack, media, static, build

Environment

Environment Info:

current version of create-react-app: 5.0.1 running from REDACTED/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app

System: OS: macOS 13.5.1 CPU: (10) arm64 Apple M1 Max Binaries: Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm Browsers: Chrome: 117.0.5938.149 Edge: Not Found Safari: 16.6 npmPackages: react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 react-scripts: 5.0.1 => 5.0.1 npmGlobalPackages: create-react-app: Not Found

Steps to reproduce

(Write your steps here:)

Expected behavior

Media file URLs in CSS should be relative to the CSS file and not incorrect as shown above.

(Write what you thought would happen.)

Actual behavior

Media paths are incorrect.

(Write what happened. Please add screenshots!)

Reproducible demo

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

boonware avatar Oct 04 '23 10:10 boonware

@boonware can i work on this issue

Chetax avatar Oct 18 '23 12:10 Chetax

@Chetax Apologies for (very!) late response. I am not the right person to ask, probably need to ask a maintainer of this project.

boonware avatar Sep 30 '24 14:09 boonware