Install Fontsource, allow the package in the asset server, and link its stylesheet. The asset server rewrites the url() references in the CSS. The preload is a hand-written <link> with a URL from getHref().
// app/assets.ts (npm i @fontsource-variable/inter)
export const assets = createAssetServer({
// …
allowPackages: ["remix", "@fontsource-variable/inter"],
files: { extensions: [".svg", ".png", ".jpg", ".woff2"] },
});
export const fontCssHref = await assets.getHref(
"node_modules/@fontsource-variable/inter/index.css",
);
export const fontHref = await assets.getHref(
"node_modules/@fontsource-variable/inter/files/inter-latin-wght-normal.woff2",
);
// app/actions/document.tsx, inside <head>
<link rel="preload" href={fontHref} as="font" type="font/woff2" crossOrigin="anonymous" />
<link rel="stylesheet" href={fontCssHref} />
Source: Remix: Files and assets, reference styles, images, and fonts