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
:
page /test
has become unavailable
It is not even visible in devtools in pages