You can choose to inline small fonts while bigger ones are served as separate assets. When loading fonts, the same techniques as for images apply.
You have to consider the browsers you want to support and choose the loading strategy based on that.
Loading fonts is similar to loading other assets. The Loader Definitions chapter covers alternatives. If you want to process font SVGs differently, set their definitions carefully. Take care with SVG images if you have SVG specific image setup in place already. If you prefer to use SVG based fonts, they can be bundled as a single font file by using webfonts-loader. The subsetting process can reduce the size of the font files dramatically. Subfont is a tool that performs static analysis against webpack's HTML output and then rewrites the fonts to include only glyphs that are used. You can override the behavior by using the fallback option. It uses file-loader underneath with the limit option. Going with one format, you can use a similar setup as for images and rely on maxSize: const config =, In the example above, the usage of file-loader is obscured url-loader. woff format based on Can I Use.woff2, is widely supported by modern browsers and is another option. If you exclude Opera Mini, all browsers support the. Font test patterns tend to be more complicated, though, and you have to worry about font file related lookups. You can still use the type loader field as with images. You can approach the problem in several ways through webpack. The problem can be solved by deciding a set of browsers and platforms that should receive first class service.
How to know what font formats to support? There can be up to four font formats to worry about if you want to provide first class support to each browser. It does come with unique challenges, though. Loading fonts is similar to loading images.