In development Nuxt 3 hosts the routes in a Virtual File System accessible at http://localhost:3000/_vfs and I can browse all the available Vue application routes from there.
However, if I try to import the routes from the VFS inside a file inside the server directory like so:
import routes from '#build/routes'
... I get the error:
ERROR Vue app aliases are not allowed in server routes. [importing #build/routes from server/api/[locale]/lalala.get.js]
I don't disagree with the error message and I guess this makes sense as the VFS isn't there in production builds.
In Nuxt 2 I could access the routes by requiring the .nuxt/routes.json
file in both development and production builds.
How can I import the routes, similar to how you could in Nuxt 2 in Nuxt 3 inside the server directory in both development and production?
Do I just write the routes to a file myself inside the pages:extend
hook?