Skip to content

feat(unplugin): add scanPackages option - #5510

Merged
benjamincanac merged 7 commits into
nuxt:v4from
ISOR3X:v4
Dec 17, 2025
Merged

benjamincanac merged 7 commits into
nuxt:v4from
ISOR3X:v4

Conversation

@ISOR3X

@ISOR3X ISOR3X commented Nov 22, 2025 •

Copy link
Copy Markdown
Contributor

πŸ”— Linked issue

Resolves #4892

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Allows adding external packages to be scanned for Nuxt UI components through the new scanPackages option. This allows using Nuxt UI as a dependency for other projects.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@github-actions github-actions Bot added the v4 #4488 label Nov 22, 2025
@ISOR3X

ISOR3X commented Nov 22, 2025

Copy link
Copy Markdown
Contributor Author

I wasn't sure about the name or location for the option. Besides the current option, I also considered extending ComponentsOptions since feature mostly relates to unplugin-vue-components. In the end I decided against it to keep that key purely for the options from that package.

@pkg-pr-new

pkg-pr-new Bot commented Nov 22, 2025 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@5510

commit: 88922e6

@benjamincanac

Copy link
Copy Markdown
Member

I'm wondering if it wouldn't be easier to just remove this exclude, do you have a reproduction to try if it doesn't decrease performances?

@ISOR3X

ISOR3X commented Nov 27, 2025

Copy link
Copy Markdown
Contributor Author

I'm wondering if it wouldn't be easier to just remove this exclude, do you have a reproduction to try if it doesn't decrease performances?

Wouldn't completely removing the exclude mean all node_module packages are scanned? I am not sure how unplugin-vue-components works, but I would expect that to take a lot longer than adding an option to scan a specific package.

@benjamincanac

Copy link
Copy Markdown
Member

@romhml What do you think of this? Maybe we should remove the hard-coded @compodium/examples and document it inside compodium to use this option with Vite?

@benjamincanac benjamincanac changed the title feat: add an option to allow external packages to be scanned for Nuxt UI components feat(unplugin): add option to allow external packages to scan for components Dec 8, 2025
@romhml

romhml commented Dec 15, 2025

Copy link
Copy Markdown
Member

@benjamincanac Removing the ignore in unplugin-auto-import can't be good for build performances. You can remove @compodium/example for the defaults, although it will make its setup a bit more complex.

@ISOR3X how do you plan to leverage this in your projects? Edit Nuxt UI's plugin config inside yours or ask users to configure it themselves?

@ISOR3X

ISOR3X commented Dec 15, 2025

Copy link
Copy Markdown
Contributor Author

@ISOR3X how do you plan to leverage this in your projects? Edit Nuxt UI's plugin config inside yours or ask users to configure it themselves?

The former. My main reason for this PR was mainly because we use Nuxt UI at the company I work at. Our UI library pretty much just wraps Nuxt UI and applies some different defaults and adds some extra components.

@benjamincanac benjamincanac changed the title feat(unplugin): add option to allow external packages to scan for components feat(unplugin): add scanPackages option Dec 17, 2025

@benjamincanac benjamincanac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed to scanPackages and updated the docs.

@benjamincanac
benjamincanac merged commit 4e57139 into nuxt:v4 Dec 17, 2025
17 checks passed

This branch was successfully deployed

1 active deployment
Preview – ui β€” 88922e6b Deployed Dec 17, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using Nuxt UI in components from a npm package, in Vue

3 participants