vue3打包后报错Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘nextSibling‘)

Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘nextSibling’)

vue3本地运行不报错,打包后报这个错误

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'nextSibling')

一、这个时候需要检查一下有木有组件是空的,像这样:

<template>
</template>

此时需要在里面加点内容就好了

<template>
<div>哈哈哈</div>
</template>

二、 检查App.vue,如果加了弹窗或其他代码就需要在template下加个div

原代码:

<template>
    <router-view></router-view>
    <div class="mdialog" v-if="Show">
      <el-alert custom-class="custom-alert" title="提示" 
        :closable="false" />
    </div>
</template>

修改后:

<template>
   <div>
    <router-view></router-view>
    <div class="mdialog" v-if="Show">
      <el-alert custom-class="custom-alert" title="提示" 
        :closable="false" />
    </div>
    <div>
</template>