Vue.js

Vueのcomposition APIのエラー:Cannot read property ‘util’ of undefined

この記事の目次
  1. エラー内容
  2. エラーが出たscriptタグ
  3. 解決方法

Vueのv3を使っていて、下のエラーが出ている場合の対処方法です。

エラー内容

vue-composition-api.esm.js?a6f4:64 Uncaught (in promise) 
TypeError: Cannot read property 'util' of undefined

合わせて下の警告が出ました。

[Vue warn]: Unhandled error during execution of scheduler flush. 
This is likely a Vue internals bug. 
Please open an issue 
at https://new-issue.vuejs.org/?repo=vuejs/vue-next 
  at  
ref=Ref< undefined > > 
スポンサーリンク

エラーが出たscriptタグ

解決方法

// import { defineComponent, onMounted } from '@vue/composition-api'
import { defineComponent, onMounted } from 'vue'

importする先をvueにすることで解決します。

スポンサーリンク