fix:提交更新

This commit is contained in:
ljy
2026-08-26 00:44:25 +08:00
parent 83c52614be
commit b822d21eae
20 changed files with 1491 additions and 72 deletions
+37
View File
@@ -0,0 +1,37 @@
/**
* After vite build: copy dist/index.html to each main route folder for crawler/static hosting.
*/
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const outDir = path.resolve(__dirname, '../dist')
const ROUTES = [
'/brand',
'/poetry',
'/qingxiang',
'/haoke',
'/system',
'/tech',
'/subsidy',
'/partner',
'/tech-detail',
'/contact',
]
const indexHtml = path.join(outDir, 'index.html')
if (!fs.existsSync(indexHtml)) {
console.error('dist/index.html not found; run vite build first')
process.exit(1)
}
const html = fs.readFileSync(indexHtml, 'utf8')
for (const route of ROUTES) {
const dir = path.join(outDir, route.replace(/^\//, ''))
fs.mkdirSync(dir, { recursive: true })
fs.writeFileSync(path.join(dir, 'index.html'), html)
console.log(`prerender ${route}/index.html`)
}
console.log('Done.')