Skip to content Skip to sidebar Skip to footer

Following Documentation I Cannot Create An Instance Of Vue.js 3

The code https://stackblitz.com/edit/vue-ttt?file=src/main.js The Problem I'm trying to build a simple tic-tac-toe app in StackBlitz. This is my main.js file: import Vue from 'vue'

Solution 1:

When you work with bundler like vue-cli, webpack or vite ..., you should import createApp to create new instance and use it for app.use or app.component ... :

import { createApp } from"vue";
 const app = createApp({ /* options */ })

Using CDN like :

<scriptsrc="https://unpkg.com/vue@next"></script>

the Vue instance is available globally so you could use it as follows :

const app = Vue.createApp({ /* options */ })

Solution 2:

You are getting this error because Vue3 is using named export instead of a default export. You can read more about it here.

You can fix this error by simply importing all the named exports onto an object called Vue:

import * asVuefrom'vue';

Post a Comment for "Following Documentation I Cannot Create An Instance Of Vue.js 3"