unplugin-vue-components
unplugin-vue-components copied to clipboard
Resolving directives doesnt work
Describe the bug
It's either unclear in the documention how to resolve directives or the plugin doesnt work.
A resolver doesnt receive any directives introduced in SFC templates.
Also it's unclear how to use directives since they are defined in js/ts files.
I'm on Vue 3 and directives
option is true by default I believe.
Reproduction
Create a resolve - it doesnt receive directive names
System Info
System:
OS: Linux 5.4 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (2) x64 Intel Xeon Processor (Icelake)
Memory: 958.67 MB / 3.84 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 18.15.0 - /usr/local/bin/node
npm: 9.5.0 - /usr/local/bin/npm
Used Package Manager
npm
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.
It's working by adding a custom directive src/directives/foo.ts
, then resolve in vite.config.ts
resolvers:
{
type: 'directive',
resolve: (name: string) => {
if (name === 'Foo') return {
as: name,
from: `@/directives/foo.ts`
}
}
}