According to the Vue documentation:
Template processing differs from other webpack loaders, as pug-loader and similar template loaders return a function instead of compiled HTML. Instead of using pug-loader, opting for original pug is recommended.
TestComponent.vue:
<template lang="pug">
div
h2 {{ message }}
</template>
<script>
export default {
data () {
return {
message: 'Done!!! Done...'
}
}
}
</script>
main.js:
import Vue from 'vue'
import TestComponent from './../components/TestComponent/TestComponent.vue'
new Vue({
el: '#app',
render: h => h(TestComponent)
});
Error:
NonErrorEmittedError: (Emitted value instead of an instance of Error)
Error compiling template:
div
h2 {{ message }}
- Component template requires a root element, rather than just text.
Versions of dependencies used:
- "webpack": "^4.7.0"
- "vue": "^2.5.16"
- "vue-loader": "^15.2.4",
- "vue-template-compiler": "^2.5.16",
- "pug": "^2.0.3"