Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The validator 'all' must be a function error in prod when importing all @vee-validate/rules #4833

Open
2 of 5 tasks
Uleertel opened this issue Aug 8, 2024 · 2 comments
Open
2 of 5 tasks

Comments

@Uleertel
Copy link

Uleertel commented Aug 8, 2024

What happened?

I have a vuejs 3.4 application currently using vee-validate & vee-validate/rules libraries in version 4.12.8.
I tried to update these libraries to the latest 4.13.2 but when loading the application I have an error in the brother :
"Error: Extension Error: The validator 'all' must be a function."

The error is happening when I'm loading all the rules as explained on the npm page https://www.npmjs.com/package/@vee-validate/rules with the following code :

import { defineRule } from 'vee-validate';
import * as rules from '@vee-validate/rules';

Object.keys(rules).forEach(rule => {
  defineRule(rule, rules[rule]);
});

Reproduction steps

  1. create a vuejs application
  2. use the code provided above

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

couldn't make codesandbox work...

Code of Conduct

@tfoxkiu
Copy link

tfoxkiu commented Aug 19, 2024

Not sure when it was changed, but now instead of:

import * as rules from '@vee-validate/rules';

you have to do:

import { all as rules } from '@vee-validate/rules';

@Uleertel
Copy link
Author

Thanks it seems to do the trick. I hope someone from the project will see this and update the npm page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants