Describe the bug
I use a design system that exposes web components and I want unplugin-vue-components to auto-import these components via a custom resolver. To avoid a runtime rendering error from Vue with the web components, I had to define the isCustomElement function in the Vue compiler options.
When I enable isCustomElement (so Vue treats ux-* tags as custom elements), the resolver for unplugin-vue-components no longer appears to be invoked.
Reproducing configuration
import { defineConfig } from 'vitest/config';
import vue from '@vitejs/plugin-vue';
import Components from 'unplugin-vue-components/vite';
import path from 'node:path';
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag: string) => tag.startsWith('ux-'), // comment and un comment this line
},
},
}),
Components({
resolvers: [
(name: string) => {
if (name.startsWith('Ux')) {
return {
name,
from: `@mylib/${name}`,
};
}
},
],
globs: 'src/**/*.vue',
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
});
Expected behavior
- The resolver should be called, even when isCustomElement is set so that Vue does not transform ux-* tags into Vue components.
Actual behavior
- When isCustomElement is set no longer appears: the resolver is not invoked.
Reproduction
https://stackblitz.com/edit/vitejs-vite-yqwafxpa
System Info
npx envinfo --system --binaries --browsers
Need to install the following packages:
envinfo@7.21.0
Ok to proceed? (y) y
System:
OS: Linux 5.0 undefined
CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Used Package Manager
npm
Validations
Describe the bug
I use a design system that exposes web components and I want unplugin-vue-components to auto-import these components via a custom resolver. To avoid a runtime rendering error from Vue with the web components, I had to define the isCustomElement function in the Vue compiler options.
When I enable isCustomElement (so Vue treats ux-* tags as custom elements), the resolver for unplugin-vue-components no longer appears to be invoked.
Reproducing configuration
Expected behavior
Actual behavior
Reproduction
https://stackblitz.com/edit/vitejs-vite-yqwafxpa
System Info
npx envinfo --system --binaries --browsers Need to install the following packages: envinfo@7.21.0 Ok to proceed? (y) y System: OS: Linux 5.0 undefined CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries:Used Package Manager
npm
Validations