Skip to content

Nuxt 3 does not respect layouts in separate folders #14275

@DannyAndres

Description

@DannyAndres

Environment

Nuxt Version

  • nuxt: v3.0.0 rc-4

Reproduction

Steps to reproduce

On a clean Nuxt 3 install.

Create a layout inside a folder like.

layouts/mobile/custom.vue

Use it in a page as follows.

<NuxtLayout name="mobile/custom"> some code ... </NuxtLayout>

Describe the bug

When I create a layout inside a folder like "layouts/mobile/custom.vue" and use it inside of "pages/index.vue" on a clean install of Nuxt 3 as follows.

<NuxtLayout name="mobile/custom"> some code ... </NuxtLayout>

It does not work, I don't know if this feature is not supported yet or if it is a bug, because when I went through the Nuxt 2 info I found this which came out thanks to an issue of this exact same problem in Nuxt 2

Adds support for folders in /layouts nuxt/nuxt.js#12765

Normal layout use like Nuxt 3 documentation works just fine, "layouts/custom.vue" inside of "pages/index.vue" like this.

<NuxtLayout name="custom"> some code ... </NuxtLayout>

What is Expected?

Is expected to work exactly as normal layouts would.

What is actually happening?

Got an error in console as if the layout does not exists.

Invalid layout "mobile/custom" selected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions