You are using the runtime-only build of Vue where the template compiler is not available

webpack打包运行vue程序出现的问题?
在这里插入图片描述
解决方法:
根据错误显示我们知道是runtime-only的问题
runtime-only中代码不允许有template存在
runtime-compiler中代码可以有template的存在,因为compiler可以用于编译template
将runtime-only改成runtime-compiler即可
在这里插入图片描述
在vue.esm.js中就存在compiler,所以改下配置即可
在这里插入图片描述
在webpack.cofing.js中配置个属性resolve

resolve:{
    
    
    alias:{
    
    
      'vue$':'vue/dist/vue.esm.js'
    }
  }

猜你喜欢

转载自blog.csdn.net/dwjdj/article/details/108320084