Static GitHub Issues

[2586] app.addRoutes error on v1.1.1

prev: Module - use this.nuxt.plugin give error (how use new hook system correct)
next: nuxt.plugin('build',..) is not supported. Use new hooks system.

I just upgraded from 1.0.0-rc8 to 1.1.1 and I get an error when using app.router.addRoutes in a plugin:

import mycustompage from "@/custompages/mycustompage.vue";

export default async ({app}) => {
	app.router.addRoutes([
		{
			path: "/",
			name: "index",
			component: mycustompage
		}
	]);
};

Cannot read property 'layout' of undefined .nuxt/server.js:123:

  // ...If there is a redirect or an error, stop the process
  if (ssrContext.redirected) return noopApp()
  if (ssrContext.nuxt.error) return renderErrorPage()

  /*
  ** Set layout
  */
  let layout = Components.length ? Components[0].options.layout : NuxtError.layout
  if (typeof layout === 'function') layout = layout(app.context)
  await _app.loadLayout(layout)
  layout = _app.setLayout(layout)

it seems options is missing from the Component.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2249">#c2249</a>)</em></sub></div>