Skip to content

experimental.componentDetection fails if NuxtUI is used in a remote layer #5389

@remihuigen

Description

@remihuigen

Environment

  • Operating System: Darwin
  • Node Version: v22.15.0
  • Nuxt Version: 4.2.0
  • CLI Version: 3.29.3
  • Nitro Version: 2.12.8
  • Package Manager: pnpm@10.13.1
  • Builder: -
  • User Config: extends, modules, alias, imports, components, ui, runtimeConfig, nitro, $production, routeRules, app, css, sitemap
  • Runtime Modules: -
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Package

v4.x

Version

4.1.0

Reproduction

If necessary i can create a reproduction, but due to the nature of this bug that would require some effort. That being said, im happy to do it if necessary

Description

experimental.componentDetection is enabled, it only scans the source code. When working with packaged Nuxt layers (and probably modules) that include NuxtUI, it fails to detect the components used exclusively in those remote source. Hence the css from those components is tree shaken.

I have a base layer that contains common configuration and shared UI between projects. This layer is published as a private npm packages.

I guess the same issue applies to using layers from a remote gh repo with c12.

Maybe the componentDetection config should be extended with an options for which dirs to scan? that way we can add code from within the node_modules

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2-mediumNotable issue or useful enhancementv4#4488

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions