Home

Issue: 2586

app.addRoutes error on v1.1.1

[issue link]

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.

This question is available on Nuxt.js community (#c2249)