feat: Introduce SSG

This commit is contained in:
deytenit committed 2026-02-15 18:48:51 +03:00
1 parent 7fd11d2220
commit 0784e0b305
13 files changed
+157 -47

No files matched your search

+2 -8
View File
@@ -1,4 +1,4 @@
import { defineServiceConfig } from '@ermnvldmr/rsbuild-config/dev';
import { defineServiceConfig, discoverEntries } from '@ermnvldmr/rsbuild-config/dev';
import { pluginMdx } from '@rsbuild/plugin-mdx';
import remarkFrontmatter from 'remark-frontmatter';
import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
@@ -12,12 +12,6 @@ export default defineServiceConfig({
}),
],
source: {
entry: {
index: './src/app/index.tsx',
'articles/index': './src/app/articles/index.tsx',
'articles/2026/test-article': './src/app/articles/2026/test-article.tsx',
'articles/2026/matrix-server-deployment-guide':
'./src/app/articles/2026/matrix-server-deployment-guide.tsx',
},
entry: discoverEntries(import.meta.dirname, './src/app/**/*.tsx'),
},
});
+8 -2
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { createRoot, hydrateRoot } from 'react-dom/client';
import '../../static/global.css'; // Ensure global styles are available
/**
@@ -30,10 +30,16 @@ export function createPage(Component: React.ComponentType, options: PageOptions
}
if (rootElement) {
createRoot(rootElement).render(
const node = (
<React.StrictMode>
<Component />
</React.StrictMode>
);
if (rootElement.hasChildNodes()) {
hydrateRoot(rootElement, node);
} else {
createRoot(rootElement).render(node);
}
}
}