Skip to content

Commit 5eef811

Browse files
committed
Enhance Vite config to include copying of functions directory to dist for Cloudflare Pages deployment, improving static site functionality.
1 parent ded91d0 commit 5eef811

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

examples/web/vite.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import vue from '@vitejs/plugin-vue'
22
import { defineConfig, type Plugin } from 'vite'
33
import { resolve } from 'path'
4-
import { readFileSync, existsSync, mkdirSync, copyFileSync } from 'fs'
4+
import { readFileSync, existsSync, mkdirSync, copyFileSync, cpSync } from 'fs'
55

66
const AI_USER_AGENTS = [
77
'anthropic-ai',
@@ -62,6 +62,14 @@ function llmsTxtPlugin(): Plugin {
6262
}
6363
copyFileSync(llmsPath, resolve(outputDir, 'llms.txt'))
6464
console.log('✓ Copied llms.txt to dist/')
65+
66+
// Copy functions/ directory to dist/ for Cloudflare Pages
67+
const functionsDir = resolve(__dirname, 'functions')
68+
const distFunctionsDir = resolve(outputDir, 'functions')
69+
if (existsSync(functionsDir)) {
70+
cpSync(functionsDir, distFunctionsDir, { recursive: true })
71+
console.log('✓ Copied functions/ to dist/functions/')
72+
}
6573
},
6674
}
6775
}

0 commit comments

Comments
 (0)