Versions
Describe the bug
I am getting this error:
"export 'default' (imported as 'VeeValidate') was not found in 'vee-validate'
My main.js
```
// VeeValidate
import VeeValidate from 'vee-validate';
import { ValidationProvider} from 'vee-validate';
import ValidationMessage from "@/views/shared/ValidationMessage";
Vue.component('ValidationProvider', ValidationProvider);
Vue.component('ValidationObserver', ValidationObserver);
Vue.component('ValidationMessage', ValidationMessage);
Vue.use(VeeValidate, {
inject: true,
fieldsBagName: '$veeFields',
errorBagName: '$veeErrors'
})
Also
To solve:
import * as VeeValidate from 'vee-validate';
VeeValidate 3.0 no longer needs to be installed by Vue, and thus it doesn't have any default exports.
So these lines are not doing anything at all:
Vue.use(VeeValidate, {
inject: true,
fieldsBagName: '$veeFields',
errorBagName: '$veeErrors'
})
make sure to read the documentation as a lot has changed.
I tried all ways man. So I switched to 2.1.5
Also this error exists on your demos..
If I switch to 3.0.0 gets this error:
No such validator 'required' exists.
VeeValidate 3.0 introduced a lot of breaking changes, you should not migrate older projects if they depend heavily on v-validate directive.
You can find the changes detailed here #2222
Actually it's new project and there is no v-validate directive.
Ok great, that should make it easier to upgrade.
To sum it up for you, the breaking changes are:
import VeeValidate from 'vee-validate';Validator and Error Bag no longer exist, use validate function instead.Again all of this is documented in #2222
If you have a look in the vee-validate files (eg node_modules/vee-validate/dist/vee-validate.js) you can see what gets exported. I'm using v3.3.0 and it says the following:
exports.ValidationObserver = ValidationObserver;
exports.ValidationProvider = ValidationProvider;
exports.configure = configure;
exports.extend = extend;
exports.localeChanged = localeChanged;
exports.localize = localize;
exports.normalizeRules = normalizeRules;
exports.setInteractionMode = setInteractionMode;
exports.validate = validate;
exports.version = version;
exports.withValidation = withValidation;
So if i want to be able to call the localize function then i can import it as:
import { localize } from 'vee-validate';
This way you dont have to import everything, just what you need.
To solve:
import * as VeeValidate from 'vee-validate';
This worked for me, thanks a lot!
Most helpful comment
To solve:
import * as VeeValidate from 'vee-validate';