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

Fonts are not loaded in IE11 with built app #4585

Open
michaelperrin opened this issue Jun 7, 2018 · 12 comments
Open

Fonts are not loaded in IE11 with built app #4585

michaelperrin opened this issue Jun 7, 2018 · 12 comments

Comments

@michaelperrin
Copy link

michaelperrin commented Jun 7, 2018

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

fonts

Environment

Environment:
OS: macOS High Sierra 10.13.4
Node: 8.9.4
Yarn: 1.6.0
npm: 5.6.0
Watchman: Not Found
Xcode: Not Found
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.4.0 => 16.4.0
react-dom: ^16.4.0 => 16.4.0
react-scripts: 1.1.4 => 1.1.4

Steps to Reproduce

  1. Create a new project with create-react-app
  2. Add a font in the src/font dir
  3. Add the necessary CSS to use this font using @font-face in index.css like in this example:
@font-face {
    font-family: 'OpenSans-Regular';
    src: url('./fonts/OpenSans/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('./fonts/OpenSans/OpenSans-Regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'OpenSans-Regular', sans-serif;
}
  1. Run yarn start and open http://localhost:3000 in Internet Explorer 11 (using a VM may be a nice idea) and check that your font is used for the text (this is the expected behavior).
  2. Stop the process and run yarn build
  3. Run the built page by running serve -s build
  4. Open http://localhost:3000 with Chrome, Firefox, etc. You will see that the used font is OpenSans
  5. Now open the same URL with Internet Explorer 11.

Expected Behavior

IE11 should display the text with the OpenSans font when the project is built.

Actual Behavior

The OpenSans font is not downloaded and the text is shown as sans-serif.

IE 11 (see how the text is rendered):

ie

Chrome:
react_app_-_font_test

Reproducible Demo

I created a repository to show the problem here: https://github.com/michaelperrin/create-react-app-font-problem.
Steps to reproduce:

  1. Clone my demo repo: git clone https://github.com/michaelperrin/create-react-app-font-problem.git
  2. Run the following commands:
 yarn global add serve
 yarn build
 serve -s build
  1. Open http://localhost:3000 with Chrome, Firefox, etc. You will see that the used font is OpenSans
  2. Now open the same URL with Internet Explorer 11 (using a VM may be a nice idea).

A few notes:

  • This is not due to the fact that you are running the project on localhost (I hosted it on a server and got the same problem).
  • This is not due to font formats (IE11 does support EOT files).
  • This happens with any font.
  • This is not due to security parameters of IE11 (font download is enabled).
  • I hope I didn't miss something and that this is an actual bug 😉
@stereobooster
Copy link
Contributor

@Timer Timer added this to the 2.x milestone Oct 5, 2018
@raffaeu
Copy link

raffaeu commented Oct 7, 2018

Facing the same exact problem with create-react build and IE 11 using Ant Design. Apparently seems to be a problem with Create React.
Would be nice to know if there is any workaround. cache-control doesn't work for us

@Timer Timer removed this from the 2.x milestone Nov 2, 2018
@nemanja-stojanovic-mqsoftrs
Copy link

nemanja-stojanovic-mqsoftrs commented Nov 6, 2018

Same problem as @raffaeu. Built version of create-react-app doesn't show correct fonts in IE11. I also use Ant Design for styling. Adding meta tags doesn't work for me.

@stale
Copy link

stale bot commented Dec 6, 2018

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 Dec 6, 2018
@raffaeu
Copy link

raffaeu commented Dec 6, 2018 via email

@stale stale bot removed the stale label Dec 6, 2018
@baitun
Copy link

baitun commented Dec 7, 2018

Problem is still actual

@stale
Copy link

stale bot commented Jan 6, 2019

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 Jan 6, 2019
@idtirba
Copy link

idtirba commented Jan 9, 2019

Can also confirm the bug. Will this be addressed?

@stale stale bot removed the stale label Jan 9, 2019
@Timer
Copy link
Contributor

Timer commented Jan 10, 2019

This may be related to #4121. Can someone confirm? We could fix it quicker then.

@idtirba
Copy link

idtirba commented Jan 17, 2019

I can confirm the bug is related to #4121.

@avilde
Copy link

avilde commented Jun 10, 2019

I have noticed the same issue on IE11. In development mode the fonts are loaded but when I build the application (npm run build) and then serve the files (either serve -s build or put on production environment like Azure) the fonts are somehow ignored.

I checked the bundled CSS file and this is what is added:

@font-face {
  font-family: Open Sans;
  font-style: normal;
  font-weight: 400;
  src: local('Open Sans Regular'), local('OpenSans-Regular'),
    url(/fonts/open-sans-v15-latin_latin-ext-regular.woff2) format('woff2'),
    url(/fonts/open-sans-v15-latin_latin-ext-regular.woff) format('woff');
}

Not sure what needs to be added here.
Maybe embedded opentype but that is for IE8-9.

@sujeetsharma1980
Copy link

I am also facing the same exact problem with IE 11. Is there any workaround? Kind a blocker for my application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants