title: Dynamic Nuxt page selection
body: <p>Basically I'm trying to either dynamically select a component for a matched route or have an internal rewrite so I can select a different route without changing url.</p>
  
  <p>My solution right now:
  I have url's from an external resource I want to match, I'm catching these with a wildcard page in Nuxt using a <code>_.js</code>. In a middleware on this page I will determine the actual type of the page it should be (cmspage, productdetail, etc.) and place the result in the store. Then I would check if the data is found in the validate function so I can return a 404 if needed. If successful, would then use the render function to render <code>components/pages/cms.vue</code> or whatever type of page.</p>
  
  <p>So this should work (still need most of the implementation) but <strong>it has the problem that I can't use a lot of Nuxt features (middleware, asyncData, fetch, validate, more?) that are available for pages which is exactly what I'm trying to achieve.</strong></p>
  
  <p>This nuxt config extension doesn't work but would be perfect:</p>
  
  <pre><code>{
    router: {
      extendRoutes(routes, resolve) {
        routes.push({
          path: '*',
          component: async () =&gt; {
            const pageType = 'pdp' // await getPageType()
            switch (pageType) {
              case 'cms':
                return resolve(__dirname, 'pages/cmsPage.vue')
              case 'pdp':
                return resolve(__dirname, 'pages/productDetailPage.vue')
              case 'plp':
                return resolve(__dirname, 'pages/productListPage.vue')
            }
          }
        })
      }
    }
  }
  </code></pre>