How to include Roboto font in webpack build for Material UI

material-uirobotowebfontswebpack

For a progressive web app based on Material UI (React) and built with Webpack, how do I properly include Roboto font(s) so that the app does not depend on Google servers and fonts also work offline ?

So, what is a good and simple solution to bundle the right Roboto files with my application?

Best Answer

You can also do it like it is documented in this issue: https://github.com/callemall/material-ui/issues/6256

npm install typeface-roboto --save

Then, in your index.js:

import 'typeface-roboto'

Works with webpack/create-react-app.