mirror of
https://github.com/samber/awesome-prometheus-alerts.git
synced 2026-06-25 02:46:59 +08:00
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:
parent
b1764267dc
commit
07c685fee1
1 changed files with 4 additions and 6 deletions
|
|
@ -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'],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue