diff --git a/packages/nuxt/src/components/module.ts b/packages/nuxt/src/components/module.ts index 4c5dc50c77..a2a1d8ca7d 100644 --- a/packages/nuxt/src/components/module.ts +++ b/packages/nuxt/src/components/module.ts @@ -21,6 +21,9 @@ function compareDirByPathLength ({ path: pathA }: { path: string }, { path: path return pathB.split(SLASH_SEPARATOR_RE).filter(Boolean).length - pathA.split(SLASH_SEPARATOR_RE).filter(Boolean).length } +const DEFAULT_COMPONENTS_DIRS_RE = /\/components(?:\/(?:global|islands))?$/ +const STARTER_DOT_RE = /^\./g + export type getComponentsT = (mode?: 'client' | 'server' | 'all') => Component[] export default defineNuxtModule({ @@ -75,8 +78,6 @@ export default defineNuxtModule({ })) } - const DEFAULT_COMPONENTS_DIRS_RE = /\/components(?:\/(?:global|islands))?$/ - const STARTER_DOT_RE = /^\./g // Resolve dirs nuxt.hook('app:resolve', async () => { // components/ dirs from all layers diff --git a/packages/nuxt/src/components/plugins/islands-transform.ts b/packages/nuxt/src/components/plugins/islands-transform.ts index 2b854b9bbc..a3e2aba41a 100644 --- a/packages/nuxt/src/components/plugins/islands-transform.ts +++ b/packages/nuxt/src/components/plugins/islands-transform.ts @@ -24,20 +24,20 @@ interface ComponentChunkOptions { buildDir: string } +const SCRIPT_RE = /]*>/gi +const HAS_SLOT_OR_CLIENT_RE = /]*>|nuxt-client/ +const TEMPLATE_RE = /