Skip to content

禁止重写为静态路由。

禁止重写:当使用 ‘server’ 输出时,你尝试使用静态路由 ‘TO’ 重写按需路由 ‘FROM’。

静态路由 ‘TO’ 由标记为预渲染的组件 ‘COMPONENT’ 渲染。这是一个禁止的操作,因为在构建期间,组件 ‘COMPONENT’ 被编译为 HTML 文件,而 Astro 在运行时无法检索该文件。

¥ForbiddenRewrite: You tried to rewrite the on-demand route ‘FROM’ with the static route ‘TO’, when using the ‘server’ output.

The static route ‘TO’ is rendered by the component ‘COMPONENT’, which is marked as prerendered. This is a forbidden operation because during the build the component ‘COMPONENT’ is compiled to an HTML file, which can’t be retrieved at runtime by Astro.

¥What went wrong?

使用 "server" 输​​出时,不能使用 Astro.rewrite() 用静态路由重写按需路由。

¥Astro.rewrite() can’t be used to rewrite an on-demand route with a static route when using the "server" output.

Astro 中文网 - 粤ICP备13048890号