[plugin:vite:vue] [vue/compiler-sfc] This experimental syntax requires enabl…

Forums Vue 3 Migration Errors [plugin:vite:vue] [vue/compiler-sfc] This experimental syntax requires enabl…

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #122254
    albanaavdiu
    Participant

    The error Uncaught SyntaxError: The requested module ‘http://localhost:5173/node_modules/.vite/deps/vue.js?v=24e26ac2’ doesn’t provide an export named: ‘default’ typically occurs because you’re trying to import Vue using the default export, but Vue 3 uses named exports.

    How to Fix It
    In Vue 3, you need to adjust how you’re importing Vue in your project. Specifically, Vue 3 doesn’t have a default export like Vue 2 did. Here’s how to resolve the issue:

    1. Update Your Vue Import
    In your main.js or main.ts (wherever Vue is being imported), update the import statement:
    —————————————————————————-
    // Old, incorrect way (from Vue 2)
    import Vue from ‘vue’;

    // Correct way for Vue 3 (with named export)
    import { createApp } from ‘vue’;

    —————————————————————————-

    • This topic was modified 7 months, 3 weeks ago by albanaavdiu.
    • This topic was modified 7 months, 3 weeks ago by albanaavdiu.
    • This topic was modified 7 months, 3 weeks ago by albanaavdiu.
    #122261
    albanaavdiu
    Participant

    To resolve the issue, it’s crucial to pay attention to how the module is being imported. Specifically, the error “doesn’t provide an export named ‘default'” indicates that the module you’re trying to import doesn’t have a default export

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.