uniapp-router-view-loader
uniapp-router-view-loader copied to clipboard
`handleRouteFile` hooks problem
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)
}