- CLAUDE.md 운영 규칙 - wiki/ 정리된 지식 페이지 (Nuxt + Claude Code) - raw/ 원본 자료 - reference/ Nuxt 4.x 공식 문서 Co-authored-by: Cursor <cursoragent@cursor.com>
1.5 KiB
1.5 KiB
title, description, links
| title | description | links | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| defineRouteRules | Define route rules for hybrid rendering at the page level. |
|
::read-more{to="/docs/4.x/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
This feature is experimental and in order to use it you must enable the experimental.inlineRouteRules option in your nuxt.config.
::
Usage
<script setup lang="ts">
defineRouteRules({
prerender: true,
})
</script>
<template>
<h1>Hello world!</h1>
</template>
Will be translated to:
export default defineNuxtConfig({
routeRules: {
'/': { prerender: true },
},
})
::note
When running nuxt build, the home page will be pre-rendered in .output/public/index.html and statically served.
::
Notes
- A rule defined in
~/pages/foo/bar.vuewill be applied to/foo/barrequests. - A rule in
~/pages/foo/[id].vuewill be applied to/foo/**requests.
For more control, such as if you are using a custom path or alias set in the page's definePageMeta, you should set routeRules directly within your nuxt.config.
::read-more{to="/docs/4.x/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
Read more about the routeRules.
::