Update Astro configuration to use Fastify adapter and include prefetch integration

- Replaced the Node adapter with Fastify for improved performance.
- Added the @astrojs/prefetch integration to enhance resource loading.
- Updated server settings to adjust logging level and minification options.
- Modified package.json to include new dependencies for Fastify and prefetch.
This commit is contained in:
2025-07-02 22:52:53 +02:00
parent 2cb5f4bf24
commit efdd0c28d4
4 changed files with 756 additions and 4 deletions

View File

@@ -8,11 +8,12 @@ import tailwind from '@astrojs/tailwind';
import mdx from '@astrojs/mdx';
import react from '@astrojs/react';
import partytown from '@astrojs/partytown';
import node from '@astrojs/node';
import icon from 'astro-icon';
import compress from 'astro-compress';
import type { AstroIntegration } from 'astro';
import astrowind from './vendor/integration';
import fastify from '@astrojs/fastify';
import prefetch from '@astrojs/prefetch';
import { readingTimeRemarkPlugin, responsiveTablesRehypePlugin, lazyImagesRehypePlugin } from './src/utils/frontmatter';
@@ -24,7 +25,7 @@ const whenExternalScripts = (items: (() => AstroIntegration) | (() => AstroInteg
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
adapter: fastify(),
server: {
port: 3000,
@@ -79,12 +80,14 @@ export default defineConfig({
Image: true,
JavaScript: true,
SVG: false,
Logger: 1,
Logger: 0,
}),
astrowind({
config: './src/config.yaml',
}),
prefetch(),
],
image: {
@@ -97,6 +100,9 @@ export default defineConfig({
},
vite: {
build: {
minify: 'esbuild',
},
resolve: {
alias: {
'~': path.resolve(__dirname, './src'),