Serve only indexable pages to crawlers and copy the SEO files into the Vite/Docker build output. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
574 B
TypeScript
21 lines
574 B
TypeScript
import { copyFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
function copySeoFiles() {
|
|
return {
|
|
name: "copy-seo-files",
|
|
closeBundle() {
|
|
const root = resolve(__dirname);
|
|
const outDir = resolve(root, "dist");
|
|
copyFileSync(resolve(root, "robots.txt"), resolve(outDir, "robots.txt"));
|
|
copyFileSync(resolve(root, "sitemap.xml"), resolve(outDir, "sitemap.xml"));
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), copySeoFiles()],
|
|
});
|