0
votes

I recently upgraded to vue3 using vue-next and when I run yarn serve I get some warnings.

import Vue from 'vue'; causes this warning "export" 'Vue' was not found in 'vue'.

import { createApp, h } from 'vue' works fine!

package.json

{
  ...
  "dependencies": {
    ...,
    "vue": "^3.0.0-beta.1"
  }
}

Similar threads:

3

3 Answers

0
votes

Have you tried:

if (process.client) {
  import Vue from 'vue'
}

For more clarification https://nuxtjs.org/faq/window-document-undefined

0
votes

try importing with this.

if (process.client) {
  import vue from 'vue'
}
0
votes

You say you've recently upgraded to Vue 3. The import Vue from 'vue' syntax is no longer supported, since Vue has been restructured to support tree-shaking.

Instead of trying to use Vue.function, simply import { function } from 'vue' and use it directly.

This is documented in the migration guide here: https://v3.vuejs.org/guide/migration/global-api-treeshaking.html#global-api-treeshaking

I'd recommend giving the rest of the migration guide (at least the breaking changes) a read-through as well. It's very handy.