fix: resolve Astro build errors in astro.config.mjs

- Remove assetsInclude yml which caused Vite to treat YAML files as static assets instead of running them through the custom YAML transform plugin; data.groups was undefined at runtime because the import resolved to a URL rather than parsed content
- Deduplicate old-path redirects: emit only the slash-less variant per service to avoid Astro router collision warnings (trailing-slash variant is handled automatically)
This commit is contained in:
Samuel Berthe 2026-04-10 21:05:10 +02:00
parent b1764267dc
commit 07c685fee1
No known key found for this signature in database
GPG key ID: 64863511FFBD0E3C

View file

@ -49,11 +49,10 @@ function buildRedirects(base) {
// Old anchor slug (spaces → hyphens only, no other substitutions) // Old anchor slug (spaces → hyphens only, no other substitutions)
const oldSlug = service.name.replace(/ /g, '-').toLowerCase(); const oldSlug = service.name.replace(/ /g, '-').toLowerCase();
const newPath = `${base}/rules/${groupSlug}/${serviceSlug}/`; const newPath = `${base}/rules/${groupSlug}/${serviceSlug}/`;
// Redirect from flat old path (with and without trailing slash) // Redirect from flat old path (without trailing slash; Astro handles the slash variant)
for (const oldPath of [`${base}/rules/${oldSlug}`, `${base}/rules/${oldSlug}/`]) { const oldPath = `${base}/rules/${oldSlug}`;
if (oldPath !== newPath && oldPath !== newPath.slice(0, -1)) { if (oldPath !== newPath && oldPath !== newPath.slice(0, -1)) {
redirects[oldPath] = { destination: newPath, status: 301 }; redirects[oldPath] = { destination: newPath, status: 301 };
}
} }
} }
} }
@ -102,6 +101,5 @@ export default defineConfig({
], ],
vite: { vite: {
plugins: [yamlPlugin()], plugins: [yamlPlugin()],
assetsInclude: ['**/*.yml'],
}, },
}); });