unplugin-vue-components
unplugin-vue-components copied to clipboard
pnpm workspace is not supported
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.
same problem
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