Skip to content

Conversation

@marcDeSantis
Copy link

I needed a way to check for unused components in a large nuxt project. Nuxt supports dynamic imports of components in the components directory, so the RegEx needed tweaking to check for situations where the component is referenced in a template (eg <PathComponent) or even returned as a function to be used dynamically (eg return 'PathComponent')

To use this feature, pass in the -d flag.

Note that when using the dynamic mode, only files in the /components directory will be identified as unused, so that we can ignore false positives in nuxt that are found in the /pages or /layouts directory.

Note that this assumes you're using one approach or the other. If we wanted to support both import methods, we could pass both RegExp statements into textSearch.findAsPromise, but it will slow down the run time.

@BryceBarbara
Copy link

@BerniWittmann Is this still being maintained? Is there a reason this PR is still open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants