this loader allows you to resue component's template and don't need to create the SFC file for the component
<component name="welcome">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</component>
<component name="mytitle">
<h1>title</h1>
</component>
<template>
<div id="app">
<h1>with vue-enhance-loader</h1>
<mytitle />
<welcome />
<mytitle />
<welcome />
</div>
</template>
<sciprt>
import HelloWorld from 'path/to/...'
export default {
component: {
HelloWorld
}
}
</sciprt>
it's very simple and easy to use.
// in vue.config.js
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
chainWebpack(config) {
config.module
.rule('vue')
.use('my-enhance-vue-loader')
.loader('path/to/vue-enhance-loader.js')
}
})