fix(www): resolve SSG build issues with font preloads, dark theme and… (#7)
… RU locale - Fix depth-dependent duplicate font preload prefixes by using locale-absolute fontBase path and publicPath:false on html.tags to prevent Rsbuild from re-applying assetPrefix (path.posix.join behavior with MPA nested entries) - Fix .dark CSS rule stripped by critters: set reduceInlineStyles:false so critters only processes external stylesheets and leaves inline theme init styles (THEME_INIT_STYLES) intact - Fix NormalModuleReplacementPlugin lost in mergeConfig: refactored locale MDX replacement from tools.rspack function into a proper Rsbuild plugin so mergeConfig concatenates plugin arrays correctly (enables RU locale articles) - Extend Critters type declaration to include reduceInlineStyles option Made-with: Cursor
This commit is contained in:
1 parent
f5e901c131
commit
cd40139eea
3 files changed
+42
-23
No files matched your search
@@ -6,7 +6,8 @@ import { pluginMdx } from '@rsbuild/plugin-mdx';
|
||||
import remarkFrontmatter from 'remark-frontmatter';
|
||||
import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
|
||||
|
||||
const fontBase = 'static/font';
|
||||
const locale = process.env.LOCALE ?? 'en';
|
||||
const fontBase = `/${locale}/static/font`;
|
||||
|
||||
export default defineServiceConfig(
|
||||
mergeConfig(localeRsbuildConfig(), {
|
||||
@@ -44,6 +45,7 @@ export default defineServiceConfig(
|
||||
href: `${fontBase}/lato-400.woff2`,
|
||||
crossorigin: true,
|
||||
},
|
||||
publicPath: false,
|
||||
},
|
||||
{
|
||||
tag: 'link',
|
||||
@@ -54,6 +56,7 @@ export default defineServiceConfig(
|
||||
href: `${fontBase}/lato-700.woff2`,
|
||||
crossorigin: true,
|
||||
},
|
||||
publicPath: false,
|
||||
},
|
||||
{
|
||||
tag: 'link',
|
||||
@@ -64,6 +67,7 @@ export default defineServiceConfig(
|
||||
href: `${fontBase}/eb-garamond-var.woff2`,
|
||||
crossorigin: true,
|
||||
},
|
||||
publicPath: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user