fix: update md-loader

This commit is contained in:
zazzaz 2020-08-13 22:17:53 +08:00
parent 21f459d197
commit bb890a99b2

View File

@ -27,10 +27,15 @@ function pad(source) {
.join('\n')
}
const templateReplaceRegex = /<template>([\s\S]+)<\/template>/g
function genInlineComponentText(template, script) {
// https://github.com/vuejs/vue-loader/blob/423b8341ab368c2117931e909e2da9af74503635/lib/loaders/templateLoader.js#L46
let source = template
if (templateReplaceRegex.test(source)) {
source = source.replace(templateReplaceRegex, '$1')
}
const finalOptions = {
source: `<div>${template}</div>`,
source: `<div>${source}</div>`,
filename: 'inline-component', // TODO这里有待调整
compiler: TemplateCompiler,
compilerOptions: {