Astro站点用Vercel适配器部署Hybrid模式时静态页面404
Astro Hybrid模式部署Vercel后静态页面404问题
已在Vercel上部署Astro站点并设置为Hybrid模式,构建过程无错误,但出现以下问题:
- 静态资源仅存在
index.html,其他静态页面均无法正常访问 - 非静态页面可正常运行,但所有静态页面访问时都会返回Vercel的404错误,甚至自定义404页面也无法访问
Astro配置
import { defineConfig } from "astro/config"; import tailwind from "@astrojs/tailwind"; import svelte from "@astrojs/svelte"; import vercel from "@astrojs/vercel/serverless"; // https://astro.build/config export default defineConfig({ integrations: [tailwind(), svelte()], output: "hybrid", adapter: vercel(), vite: { optimizeDeps: { exclude: ["oslo"], }, }, });
构建日志(显示预渲染路径正常)
prerendering static routes 14:52:40 ▶ src/pages/404.astro 14:52:40 └─ /404.html (+1ms) 14:52:40 ▶ src/pages/alicia/invitados.astro 14:52:40 └─ /alicia/invitados/index.html (+0ms) 14:52:40 ▶ src/pages/alicia/login.astro 14:52:40 └─ /alicia/login/index.html (+0ms) 14:52:40 λ src/pages/api/login.ts 14:52:40 └─ /api/login14:52:40 [WARN] [router] No API Route handler exists for the method "GET" for the route "/api/login". Found handlers: "POST"
内容的提问来源于stack exchange,提问作者Danielo515
相关产品推荐
相关产品推荐

