diff --git a/prerender/config.cjs b/prerender/config.cjs index 877b8f3..314c9e1 100644 --- a/prerender/config.cjs +++ b/prerender/config.cjs @@ -50,10 +50,18 @@ const getWebpackEntrypoints = () => { return entrypoints; }; -// Read global CSS styles and fix font paths for prerender -let globalCss = fs.readFileSync(path.resolve(__dirname, '..', 'src', 'index.css'), 'utf8'); -// Fix relative font paths for prerendered HTML (remove ../public to make them relative to public root) -globalCss = globalCss.replace(/url\('\.\.\/public/g, "url('"); +// Read global CSS styles - use webpack processed CSS in production, raw CSS in development +let globalCss = ''; +if (isProduction) { + // In production, webpack has already processed fonts and inlined CSS + // Don't read raw src/index.css as it has unprocessed font paths + globalCss = ''; // CSS will be handled by webpack's inlined CSS +} else { + // In development, read raw CSS and fix font paths for prerender + globalCss = fs.readFileSync(path.resolve(__dirname, '..', 'src', 'index.css'), 'utf8'); + // Fix relative font paths for prerendered HTML (remove ../public to make them relative to public root) + globalCss = globalCss.replace(/url\('\.\.\/public/g, "url('"); +} // Global CSS collection const globalCssCollection = new Set();