unplugin-vue-components
unplugin-vue-components copied to clipboard
Vite HMR doesn't work for custom resolvers?
If I use the following config:
VueComponentsPlugin({
dirs: ["components"]
})
...and use a file ./components/Button.vue
as <Button>
, HMR works great.
However, if I use a config with a custom resolver like for example:
function CustomResolver(path) {
return name => {
if (!name.startsWith("Custom")) return;
return pathTools.join(__dirname, path, `${toKebabCase(name.slice(6))}.vue`);
};
}
VueComponentsPlugin({
resolvers: [CustomResolver("components")]
})
...the component resolves and imports correctly when used as <CustomButton>
, but updates to the component are not recognized until a full server restart. Not even refreshing the page will let me see my changes to the component.
I also tried ensuring dirs
is specified (in case that option is used to define where to watch):
VueComponentsPlugin({
dirs: ["components"],
resolvers: [CustomResolver("components")]
})
...however this doesn't really change anything. In this case I can use the file as <Button>
and HMR works, but if I use it as <CustomButton>
HMR doesn't work and a full server restart is required.
I am using v0.17.2.
Can you share a minimal reproduction? Thanks.
Minimal reproduction (README has steps to reproduce):
https://github.com/AaronBeaudoin/unplugin-vue-components-test
@antfu Just checking to see if you've had a chance to run the minimal reproduction and identify the issue?
@antfu Just pinging this since it's been a little over a week. Would you happen to know why this is happening?
Does anyone know why components don't update when imported with a custom resolver?
Was this fixed at some point, I updated to the newest version and everything seems to be working...?