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
- Create a new project with
create-react-app
- Add a font in the
src/font dir
- 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;
}
- 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).
- Stop the process and run
yarn build
- Run the built page by running
serve -s build
- Open http://localhost:3000 with Chrome, Firefox, etc. You will see that the used font is OpenSans
- 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):

Chrome:

Reproducible Demo
I created a repository to show the problem here: https://github.com/michaelperrin/create-react-app-font-problem.
Steps to reproduce:
- Clone my demo repo:
git clone https://github.com/michaelperrin/create-react-app-font-problem.git
- Run the following commands:
yarn global add serve
yarn build
serve -s build
- Open http://localhost:3000 with Chrome, Firefox, etc. You will see that the used font is OpenSans
- 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 😉
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
fonts
Environment
Steps to Reproduce
create-react-appsrc/fontdir@font-faceinindex.csslike in this example:yarn startand 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).yarn buildserve -s buildExpected 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):
Chrome:

Reproducible Demo
I created a repository to show the problem here: https://github.com/michaelperrin/create-react-app-font-problem.
Steps to reproduce:
git clone https://github.com/michaelperrin/create-react-app-font-problem.gitA few notes: