posva / unplugin-vue-router

Next Generation file based typed routing for Vue Router
https://uvr.esm.is
MIT License
1.47k stars 67 forks source link

how to ignore custom block `docs` in sfc? #419

Closed rainmanhhh closed 1 month ago

rainmanhhh commented 1 month ago

[Vue Router warn]: Unexpected error when starting the router: SyntaxError: The requested module '/src/components/page/PageTop.vue?vue&type=docs&index=0&lang.docs' does not provide an export named 'default'

I got above error after adding custom block docs in sfc component PageTop.vue(it's a navigation bar which will be used in route page):

<docs>
this is navigation bar
</docs>

<script lang="ts" setup>
//...
</script>
posva commented 1 month ago

À boiled down repro would help 🙂

rainmanhhh commented 1 month ago

À boiled down repro would help

https://github.com/rainmanhhh/vitesse-lite-debug

forked from vitesse-lite, just add a docs block at src/pages/index.vue

posva commented 1 month ago

Thanks! The issue seems to be because the generated component by the vue vite plugin does this:

Screenshot 2024-06-13 at 10 10 24

The router fails then.

My guess is that you need something to handle that custom block but this is not related to this plugin despite the error being reported by the router