Preload Inter font to avoid FOIT on slow connections

This commit is contained in:
Germain Souquet 2021-04-22 12:09:50 +01:00
parent 708f6a26b1
commit 417835fcca
4 changed files with 28 additions and 0 deletions

View file

@ -4,6 +4,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const webpack = require("webpack");
const HtmlWebpackInjectPreload = require('@principalstudio/html-webpack-inject-preload');
let ogImageUrl = process.env.RIOT_OG_IMAGE_URL;
if (!ogImageUrl) ogImageUrl = 'https://app.element.io/themes/element/img/logos/opengraph.png';
@ -386,6 +387,10 @@ module.exports = (env, argv) => {
chunks: ['usercontent'],
}),
new HtmlWebpackInjectPreload({
files: [{ match: /.*\.(woff2?|ttf|eot)$/ }],
}),
...additionalPlugins,
],
@ -418,6 +423,9 @@ module.exports = (env, argv) => {
hot: false,
inline: false,
},
stats: {
warnings: false,
},
};
};