Vue Cli 3 Include Runtime Compiler

Aug 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');

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.