Vue Cli 3 Include Runtime Compiler

August 24, 2018
use the compiler-included build.

You will bump into following error if you use template in non .vue file.

[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

(found in <Root>)

Example template: '<App />'.

import Vue from 'vue'
import Read from './components/App.vue'

/* eslint-disable no-new */
new Vue({
  el: '#app',
  template: '<App />',
  components: { App }
})

You can enable runtime compiler by editing vue.config.js to enable runtimeCompiler (additional 10kb of code).

module.exports = {
  runtimeCompiler: true
}

Or you can elimate template usage in .js by loading component using

new Vue({
  render: h => h(App),
}).$mount('#app');
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.