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

環境

vue2 vue-cli3 vue.config.js

 

報錯

在子組件方式內,調用Vue.component定義組件,並在子組件中使用

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

 

原因

應該是當前系統需要vue版本是runtime-only的

 

解決

在vue.config.js定義

runtimeCompiler: true,
 
 
注意:使用resolve方式不可行
chainWebpack: (config)=>{
  config.resolve.alias
  .set('Vue', path.join(__dirname, 'node_modules/vue/dist/vue.js'))
}
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章