diff --git a/lib/builder/builder.js b/lib/builder/builder.js index 9dc2c19604..4725d5d451 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -254,9 +254,7 @@ export default class Builder { }) layoutsFiles.forEach((file) => { const name = file - .split('/') - .slice(1) - .join('/') + .replace(new RegExp(`^${this.options.dir.layouts}/`), '') .replace(/\.(vue|js)$/, '') if (name === 'error') { if (!templateVars.components.ErrorPage) { diff --git a/test/fixtures/custom-dirs/custom-layouts/default.vue b/test/fixtures/custom-dirs/custom-layouts/layouts/default.vue similarity index 100% rename from test/fixtures/custom-dirs/custom-layouts/default.vue rename to test/fixtures/custom-dirs/custom-layouts/layouts/default.vue diff --git a/test/fixtures/custom-dirs/nuxt.config.js b/test/fixtures/custom-dirs/nuxt.config.js index 45c658ef3a..5b157f3b7c 100644 --- a/test/fixtures/custom-dirs/nuxt.config.js +++ b/test/fixtures/custom-dirs/nuxt.config.js @@ -2,7 +2,7 @@ export default { css: [{ src: '~/custom-assets/app.css' }], dir: { assets: 'custom-assets', - layouts: 'custom-layouts', + layouts: 'custom-layouts/layouts', middleware: 'custom-middleware', pages: 'custom-pages', static: 'custom-static',