I have a problem using a form validation named Vee Validate in Vue.js. I'm a beginner and not fully understand the import syntax. I install the vee-validate using npm i vee-validate --save
and it was placed in my node_modules. Now I import it in my main.js module and use the code given on the official page:
import { extend } from 'vee-validate';
import { required } from 'vee-validate/dist/rules';
extend('required', {
...required,
message: 'This field is required'
});
But when I open the index.html it gives an error:
Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'default'
Here is the link to vee-validate package:
Thank you for helping me. Forgive me if my question is not clear.
I have a problem using a form validation named Vee Validate in Vue.js. I'm a beginner and not fully understand the import syntax. I install the vee-validate using npm i vee-validate --save
and it was placed in my node_modules. Now I import it in my main.js module and use the code given on the official page:
import { extend } from 'vee-validate';
import { required } from 'vee-validate/dist/rules';
extend('required', {
...required,
message: 'This field is required'
});
But when I open the index.html it gives an error:
Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'default'
Here is the link to vee-validate package: https://www.npmjs./package/vee-validate?activeTab=readme
Thank you for helping me. Forgive me if my question is not clear.
Share Improve this question asked Jun 23, 2020 at 10:15 Russel SantosRussel Santos 271 gold badge1 silver badge10 bronze badges 3-
5
Are you using vue 3? I've had this error because somewhere in my (old vue 2) codebase there was something like this:
import Vue from 'vue';
– Philipp Mildenberger Commented Aug 19, 2020 at 9:34 - @PhilippMildenberger yes I already figure it out. That's exactly my problem. Thank you very much, sir! – Russel Santos Commented Aug 19, 2020 at 15:16
- 7 Care to share the solution? – yam Commented Dec 20, 2020 at 12:55
1 Answer
Reset to default 5I had the same problem when I made the migration to vuejs 3.
This: import Vue from 'vue';
has to be changed to:
import { createApp } from 'vue'
const app = createApp({})
Take a look to the guide: https://v3-migration.vuejs/breaking-changes/global-api.html#a-new-global-api-createapp