Skip to content
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

v2: fonts imported from css file are 404 if PUBLIC_URL=. #5162

Closed
sylvhama opened this issue Sep 28, 2018 · 0 comments
Closed

v2: fonts imported from css file are 404 if PUBLIC_URL=. #5162

sylvhama opened this issue Sep 28, 2018 · 0 comments
Milestone

Comments

@sylvhama
Copy link

sylvhama commented Sep 28, 2018

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

font, public_url

Environment

"react-scripts": "^2.0.1"

Steps to Reproduce

  1. Add font file with src
  2. Import this font file from a CSS file
  3. Import the CSS in your app (e.g. index.js)
  4. Create .env file and add it PUBLIC_URL=.
  5. Build and test

Expected Behavior

The font URL should be http://localhost:5000/static/media/Roboto-Regular.3e1af3ef.ttf
It was working perfectly with CRA v1.

Actual Behavior

The font URL is http://localhost:5000/static/css/static/media/Roboto-Regular.3e1af3ef.ttf

Reproducible Demo

I've created a repo to reproduce: https://github.com/sylvhama/cra2-font-bug

  1. git clone https://github.com/sylvhama/cra2-font-bug.git
  2. npm i
  3. npm run build
  4. serve -s build
  5. Open URL in browser, look at the console: Failed to decode downloaded font: http://localhost:5000/static/css/static/media/Roboto-Regular.3e1af3ef.ttf
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

2 participants