feat: self-hosting existing google fonts (#8540)

This commit is contained in:
Marcel Mraz 2024-09-24 17:30:21 +02:00 committed by GitHub
parent 6dfa18414a
commit a80cb5896a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 47 additions and 200 deletions

View file

@ -1,7 +1,6 @@
const { build } = require("esbuild");
const { sassPlugin } = require("esbuild-sass-plugin");
const { externalGlobalPlugin } = require("esbuild-plugin-external-global");
const { woff2BrowserPlugin } = require("./woff2/woff2-esbuild-plugins");
// Will be used later for treeshaking
//const fs = require("fs");
@ -45,13 +44,15 @@ const browserConfig = {
format: "esm",
plugins: [
sassPlugin(),
woff2BrowserPlugin(),
externalGlobalPlugin({
react: "React",
"react-dom": "ReactDOM",
}),
],
splitting: true,
loader: {
".woff2": "file",
},
};
const createESMBrowserBuild = async () => {
// Development unminified build with source maps
@ -100,9 +101,10 @@ const rawConfig = {
entryPoints: ["index.tsx"],
bundle: true,
format: "esm",
plugins: [sassPlugin(), woff2BrowserPlugin()],
plugins: [sassPlugin()],
loader: {
".json": "copy",
".woff2": "file",
},
packages: "external",
};