Skip to content

Commit

Permalink
refactor(nuxt): use addBuildPlugin to add DetectComponentUsagePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
IonianPlayboy committed Mar 18, 2024
1 parent 29711a7 commit cf253a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/nuxt/src/core/nuxt.ts
Expand Up @@ -214,8 +214,7 @@ async function initNuxt (nuxt: Nuxt) {
detectedComponents
}

addVitePlugin(() => DetectComponentUsagePlugin.vite(componentDetectionConfig))
addWebpackPlugin(() => DetectComponentUsagePlugin.webpack(componentDetectionConfig))
addBuildPlugin(DetectComponentUsagePlugin(componentDetectionConfig))

nuxt.hook('app:templates', (app) => {
// Skip first hook call
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/plugins/detect-component-usage.ts
Expand Up @@ -7,7 +7,7 @@ interface DetectComponentUsageOptions {
detectedComponents: Set<string>
}

export const DetectComponentUsagePlugin = createUnplugin((options: DetectComponentUsageOptions) => {
export const DetectComponentUsagePlugin = (options: DetectComponentUsageOptions) => createUnplugin(() => {
const importersToExclude = options?.exclude || []

const detectComponentUsagePatterns: Array<[importPattern: string | RegExp, name: string]> = [
Expand Down

0 comments on commit cf253a4

Please sign in to comment.