diff --git a/packages/nuxt/src/core/utils/names.ts b/packages/nuxt/src/core/utils/names.ts index a40cb4346a..9e9dff7512 100644 --- a/packages/nuxt/src/core/utils/names.ts +++ b/packages/nuxt/src/core/utils/names.ts @@ -6,7 +6,7 @@ export function getNameFromPath (path: string, relativeTo?: string) { const relativePath = relativeTo ? normalize(path).replace(withTrailingSlash(normalize(relativeTo)), '') : basename(path) - return kebabCase(relativePath.replace(/\/index\.\w+$/, '').replace(/[\\/]+/g, '-').replace(extname(relativePath), '')).replace(/["']/g, '') + return kebabCase(relativePath.replace(/\/index\.\w+$/i, '').replace(/[\\/]+/g, '-').replace(extname(relativePath), '')).replace(/["']/g, '') } export function hasSuffix (path: string, suffix: string) { diff --git a/packages/nuxt/test/app.test.ts b/packages/nuxt/test/app.test.ts index 7bebd5a6fe..bc92319335 100644 --- a/packages/nuxt/test/app.test.ts +++ b/packages/nuxt/test/app.test.ts @@ -185,6 +185,7 @@ describe('resolveApp', () => { 'layouts/default.vue', 'layouts/some/layout.vue', 'layouts/SomeOther.vue', + 'layouts/SomeOther/Thing/Index.vue', 'layouts/some.vue', 'layouts/SomeOther/layout.ts' ]) @@ -210,6 +211,10 @@ describe('resolveApp', () => { "file": "/layouts/SomeOther/layout.ts", "name": "some-other-layout", }, + "some-other-thing": { + "file": "/layouts/SomeOther/Thing/Index.vue", + "name": "some-other-thing", + }, } `) })