unplugin-vue-components icon indicating copy to clipboard operation
unplugin-vue-components copied to clipboard

pnpm workspace is not supported

Open lucasalbuquerque opened this issue 1 year ago • 2 comments

Describe the bug

Addition a relative paths to "dirs" array not working when it's outside the project dir.

My current workspace structure:

apps/
    ─ appname
         ─ src
         ...
         vite.config.ts
packages/
    ─ components
         **.vue

vite.config.ts

Components({
      dirs: ['../../packages/components', 'src/components'],
      dts: 'src/components.d.ts',
      directoryAsNamespace: true,
      resolvers: [
        IconsResolver({
          prefix: 'icon',
          customCollections: ['girassol', 'illustration'],
        }),
      ],
}),

When I create a new component inside the '../../packages/components' directory it is not being mapped in my src/components.d.ts file.

Reproduction

Above - it contained code

System Info

System:
    OS: macOS 12.6.1
    CPU: (8) arm64 Apple M2
    Memory: 70.03 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.0.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Safari: 15.6.1

Used Package Manager

pnpm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

lucasalbuquerque avatar Feb 28 '23 12:02 lucasalbuquerque

same problem

productdevbook avatar May 06 '23 17:05 productdevbook

Refer to the source code implementation. When initializing Context, dirs and root (process. cwd()) will be merged. If you use relative paths, the merged paths will be incorrect. Therefore, you need to change ../../packages/components to packages/components, hoping to be helpful for your problem https://github.com/antfu/unplugin-vue-components/blob/main/src/core/options.ts#L28 https://github.com/antfu/unplugin-vue-components/blob/main/src/core/context.ts#L37

loocus avatar Jun 08 '23 06:06 loocus