最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught SyntaxError: The requested module '@modulesvue.js' does not provide an export named &#

programmeradmin1浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 5

I 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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论