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

Wrong paths for fonts when setting homepage to "." #823

Closed
themre opened this issue Oct 2, 2016 · 4 comments
Closed

Wrong paths for fonts when setting homepage to "." #823

themre opened this issue Oct 2, 2016 · 4 comments
Milestone

Comments

@themre
Copy link
Contributor

themre commented Oct 2, 2016

Description

From 0.6.0 on I'm experience this bug, where links from Fontawesome are broken. This goes for fonts, that are referenced in the Fontawesome CSS.

Expected behavior

Link to fonts should be e.g. build/static/media/fontawesome-webfont.1dc35d25.ttf

Actual behavior

Link in css produces: build/static/css/static/media/fontawesome-webfont.1dc35d25.ttf. This goes for TTF, WOFF and WOFF2.

Environment

  1. react-scripts 0.6.1 (if you haven’t ejected):
  2. node 6.3.0:
  3. npm 3.10.3:
  4. font-awesome 4.6.3
  5. Operating system: Windows 10 64-bit
  6. Browser and version: All

Usage

I import fonts like this: import 'font-awesome/css/font-awesome.css'

@themre
Copy link
Contributor Author

themre commented Oct 3, 2016

I found out this was the cause of homepage: '.' in package.json. I wanted this since I don't have yet specified final website URL and I wanted it to send to someone to check it locally (run index.html or to put on some non-root folder on some host). Obviously this won't work. Any other solution?

@gaearon
Copy link
Contributor

gaearon commented Oct 3, 2016

Yeah, this is not really officially supported as we found a few similar issues with it. If you want to keep using that workaround, you’ll need to use public folder for any assets and manage them manually instead so that Webpack doesn’t get confused about paths.

Alternatively you could investigate what it would take to support . officially and make a PR fixing those issues. Maybe with some tweaks to configuration it would be possible.

@gaearon gaearon changed the title Fontawesome wrong paths Wrong paths for fonts when setting homepage to "." Oct 3, 2016
@robcaldecott
Copy link

I have an ugly fix for this but instead opted for the public folder as this fixes the issue.

@Timer
Copy link
Contributor

Timer commented Feb 11, 2017

Hi there! react-scripts v0.9.0 was just released which adds support for building for relative paths. You may read how to do so here.

Please test it and don't hesitate to reach out if this doesn't solve your specific use case!

@Timer Timer closed this as completed Feb 11, 2017
@Timer Timer added this to the 0.9.0 milestone Feb 11, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
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

4 participants