unplugin-vue-components
unplugin-vue-components copied to clipboard
not support "as" alias, e.g. import { xx as MyComponent } from 'element-ui'
Describe the bug
not support "as" alias.
unplugin-vue-components config:
unPluginVueComponent({
resolvers: [
(componentName: string) => {
console.log(componentName)
},
],
}),
vue template code:
import { EIRadio as MyRadio, EIRadioGroup } from 'element-ui'
run vite build, output:
# output MyRadio, it's not EIRadio
MyRadio
EIRadioGroup
And, the "resolvers" method can support the package name of import?
e.g.
unPluginVueComponent({
resolvers: [
// add "from" parameter, value is import package name
(componentName: string, from: string) => {
console.log(componentName, from)
},
],
}),
The from value is import package name, can be used to confirm where this component is referenced in package.
Reproduction
empty
System Info
System:
OS: macOS 11.6.1
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Memory: 777.81 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.18.1 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 6.14.15 - /usr/local/bin/npm
Browsers:
Chrome: 103.0.5060.114
Firefox: 96.0.2
Safari: 15.1
Used Package Manager
yarn
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.
https://antfu.me/posts/why-reproductions-are-required