Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix component library example in docs #23596

Merged
merged 1 commit into from Oct 10, 2023
Merged

docs: fix component library example in docs #23596

merged 1 commit into from Oct 10, 2023

Conversation

MooseSaeed
Copy link
Contributor

@MooseSaeed MooseSaeed commented Oct 10, 2023

πŸ”— Linked issue

resolves #21301

❓ Type of change

  • [x ] πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • [x ] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ 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

Currently, nuxt has the below example in /guide/concepts/directory-structure/components:

import { defineNuxtModule, createResolver } from '@nuxt/kit'

export default defineNuxtModule({
  hooks: {
    'components:dirs': (dirs) => {
      const { resolve } = createResolver(import.meta.url)
      // Add ./components dir to the list
      dirs.push({
        path: fileURLToPath(resolve('./components')),
        prefix: 'awesome'
      })
    }
  }
})

This example is not valid as mentioned in #21301. We can directly use resolve() like this:

import { defineNuxtModule, createResolver } from '@nuxt/kit'

export default defineNuxtModule({
  hooks: {
    'components:dirs': (dirs) => {
      const { resolve } = createResolver(import.meta.url)
      // Add ./components dir to the list
      dirs.push({
        path: resolve('./components'),
        prefix: 'awesome'
      })
    }
  }
})

πŸ“ Checklist

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

@stackblitz
Copy link

stackblitz bot commented Oct 10, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@nuxt-studio
Copy link

nuxt-studio bot commented Oct 10, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview 2cf0cfd

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

Thank you ❀️

@danielroe danielroe merged commit d0511a2 into nuxt:main Oct 10, 2023
5 of 6 checks passed
@github-actions github-actions bot mentioned this pull request Oct 10, 2023
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.

Custom component library path without fileURLToPath (possible documentation change)
2 participants