Skip to content

Commit eca9207

Browse files
committed
fix: add component renaming config
1 parent 2b29ce5 commit eca9207

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/nuxt/src/module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import { defineNuxtModule, addComponent, addImports, logger } from '@nuxt/kit';
22
import type { NuxtModule } from '@nuxt/schema';
33
import { isPackageExists } from 'local-pkg';
44

5+
type ComponentName = 'Field' | 'Form' | 'ErrorMessage' | 'FieldArray';
56
interface VeeValidateModuleOptions {
67
autoImports?: boolean;
8+
componentNames?: Partial<Record<ComponentName, string>>;
79
}
810

9-
const components = ['Field', 'Form', 'ErrorMessage', 'FieldArray'];
11+
const components: ComponentName[] = ['Field', 'Form', 'ErrorMessage', 'FieldArray'];
1012

1113
const composables = [
1214
'useField',
@@ -37,6 +39,7 @@ export default defineNuxtModule<VeeValidateModuleOptions>({
3739
},
3840
defaults: {
3941
autoImports: true,
42+
componentNames: {},
4043
},
4144
setup(options, nuxt) {
4245
if (options.autoImports) {
@@ -50,7 +53,7 @@ export default defineNuxtModule<VeeValidateModuleOptions>({
5053

5154
components.forEach(component => {
5255
addComponent({
53-
name: component,
56+
name: options.componentNames?.[component] ?? component,
5457
export: component,
5558
filePath: 'vee-validate',
5659
});

0 commit comments

Comments
 (0)