Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Nuxt 3 pages:extend route same name route file

$
0
0

When I want to add an additional route from nuxt.config.ts, the problem is that the route name is taken from the file file.

come with me :

test.vue :

<script setup lang="ts">definePageMeta({  name: "test",});</script><template><div><h1>Test Page</h1></div></template>

in nuxt.config.ts :

  hooks : {"pages:extend"(pages) {      pages.push({        name: `testExtend`,        path: `/testExtend`,        file:  "~/pages/test.vue",      });    }  }

This route is supposed to be named testExtend, but in fact its name is the same as test.vue in definePageMeta

Also in dev tools in the Pages section in Route Path:

enter image description here

page /test has become unavailable

It is not even visible in devtools in pages


Viewing all articles
Browse latest Browse all 12111

Trending Articles