enhancement(web): improve font loading performance and avoid page reflow (#1087)

* enhancement: improve font loading performance and avoid page reflow

chore: get rid of postcss-import (we're not using it and it's not needed for tailwind)

* fix indent
This commit is contained in:
stacksmash76 2023-09-09 23:07:00 +02:00 committed by GitHub
parent 64f81a4614
commit 7b77ff766e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 19 deletions

View file

@ -4,6 +4,12 @@ import { VitePWA } from "vite-plugin-pwa";
import react from "@vitejs/plugin-react-swc";
import svgr from "vite-plugin-svgr";
interface PreRenderedAsset {
name: string | undefined;
source: string | Uint8Array;
type: 'asset';
}
// https://vitejs.dev/config/
export default ({ mode }: ConfigEnv) => {
// early load .env file
@ -97,6 +103,16 @@ export default ({ mode }: ConfigEnv) => {
build: {
manifest: true,
sourcemap: true,
rollupOptions: {
output: {
assetFileNames: (chunkInfo: PreRenderedAsset) => {
if (chunkInfo.name === "Inter.var.woff2") {
return "assets/[name][extname]";
}
return "assets/[name]-[hash][extname]";
}
}
}
}
});
};