- Refactored to introduce handleSsr function in @open-gsio/client/server/index.ts for streamlined SSR handling.

- Replaced inline SSR logic in `AssetService.ts` with `handleSsr` import.
- Enhanced `build:client` script to ensure server directory creation.
- Updated dependencies and devDependencies across multiple packages for compatibility improvements.
This commit is contained in:
geoffsee
2025-06-25 16:03:13 -04:00
parent 93bec55585
commit f9249f3496
8 changed files with 364 additions and 218 deletions

View File

@@ -7,30 +7,30 @@ import { VitePWA } from 'vite-plugin-pwa';
// eslint-disable-next-line import/no-unresolved
import { configDefaults } from 'vitest/config';
const prebuildPlugin = () => ({
name: 'prebuild',
config(config, { command }) {
if (command === 'build') {
child_process.execSync('bun generate:sitemap');
console.log('Generated Sitemap -> public/sitemap.xml');
child_process.execSync('bun run generate:robotstxt');
console.log('Generated robots.txt -> public/robots.txt');
child_process.execSync('bun run generate:fonts');
console.log('Copied fonts -> public/static/fonts');
}
},
});
export default defineConfig(({ command }) => {
const customPlugins = [
{
name: 'sitemap-generator',
buildStart(options) {
if (command === 'build') {
child_process.execSync('bun run generate:sitemap');
console.log('Generated Sitemap -> public/sitemap.xml');
child_process.execSync('bun run generate:robotstxt');
console.log('Generated robots.txt -> public/robots.txt');
child_process.execSync('bun run generate:fonts');
console.log('Copied fonts -> public/static/fonts');
}
},
},
];
return {
mode: 'production',
plugins: [
...customPlugins,
prebuildPlugin(),
react(),
vike({
prerender: true,
disableAutoFullBuild: false,
}),
react(),
// PWA plugin saves money on data transfer by caching assets on the client
/*
For safari, use this script in the console to unregister the service worker.
@@ -60,7 +60,7 @@ export default defineConfig(({ command }) => {
server: {
port: 3000,
proxy: {
// proxies requests to server
// proxies requests in development
'/api': {
target: 'http://localhost:3003',
},