uniapp-router-view-loader icon indicating copy to clipboard operation
uniapp-router-view-loader copied to clipboard

`handleRouteFile` hooks problem

Open kelaikelai opened this issue 1 year ago • 0 comments

When the first node in the template is not a view tag, it seems to be causing a problem with regex and the global component is not being added correctly.
how about this?

function addCodeToHeader(source, code) {
  return source.replace(/<template(.*?)>/, s => s + code)
}


function addCodeToFooter(source, code) {
  return source.replace(/(<\/template>)(?!(([\s\S]*)(<\/template>)))/, s => code + s)
}

kelaikelai avatar Feb 15 '23 07:02 kelaikelai