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

What's wrong with webpack packaging and running vue program?
Insert picture description here
Solution:
According to the error display, we know that it is a runtime-only problem
. The code in runtime-only does not allow template to exist
. The code in runtime-compiler can have template because the compiler can be used to compile the template.
Change runtime-only to runtime- The compiler is OK
Insert picture description here
. There is a compiler in vue.esm.js, so you can change the configuration
Insert picture description here
. Configure a property resolve in webpack.cofing.js

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

Guess you like

Origin blog.csdn.net/dwjdj/article/details/108320084