From 0dd86de5862afa916b34d6e32b939a67c30f08bd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 2 Nov 2021 15:27:42 +0000 Subject: [PATCH] fix(nuxt3): use nuxt extensions for component discovery (#1649) --- packages/kit/src/config/schema/_common.ts | 2 +- packages/nuxt3/src/components/module.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kit/src/config/schema/_common.ts b/packages/kit/src/config/schema/_common.ts index e3b2613a8a..fe7d96937f 100644 --- a/packages/kit/src/config/schema/_common.ts +++ b/packages/kit/src/config/schema/_common.ts @@ -457,7 +457,7 @@ export default { * @version 3 */ extensions: { - $resolve: val => ['.js', '.mjs', '.ts', '.tsx', '.vue'].concat(val).filter(Boolean) + $resolve: val => ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.vue'].concat(val).filter(Boolean) }, /** diff --git a/packages/nuxt3/src/components/module.ts b/packages/nuxt3/src/components/module.ts index dbdc8439ea..67e941c4bc 100644 --- a/packages/nuxt3/src/components/module.ts +++ b/packages/nuxt3/src/components/module.ts @@ -26,7 +26,7 @@ export default defineNuxtModule({ const dirOptions: ComponentsDir = typeof dir === 'object' ? dir : { path: dir } const dirPath = resolveAlias(dirOptions.path, nuxt.options.alias) const transpile = typeof dirOptions.transpile === 'boolean' ? dirOptions.transpile : 'auto' - const extensions = dirOptions.extensions || ['vue'] // TODO: nuxt extensions and strip leading dot + const extensions = (dirOptions.extensions || nuxt.options.extensions).map(e => e.replace(/^\./g, '')) dirOptions.level = Number(dirOptions.level || 0)