import { loader } from 'webpack' ; export default function compileTemplateFromDescriptor ( this , sfcDescriptor , compiler ) { if ( ! sfcDescriptor ?. template ?. content ) return ; let content = sfcDescriptor . template . content ; if ( sfcDescriptor . template . lang === 'pug' ) { const pug = require ( 'pug' ) ; content = pug . render ( content , { filename : this . resourcePath } ) ; } const tags = [ ] ; const compiled = compiler . compile ( content , { modules : [ { postTransformNode : ( node ) => { tags . push ( node . tag ) ; } , } ] , } ) ; compiled . tags = tags ; return compiled ; }