Skip to content

Commit

Permalink
fix: md loader jsx _createTextVNode bug
Browse files Browse the repository at this point in the history
  • Loading branch information
notbucai committed Nov 27, 2021
1 parent c0292fc commit f6e412a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions website/md-loader/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const compiler = require('@vue/compiler-sfc')

function stripScript (content) {
const result = content.match(/<(script) ?(lang="[tj]sx?")?>([\s\S]+)<\/\1>/)
return result && result[3] ? result[3].trim() : ''
const result = content.match(/<(script) ?(?:lang="[tj]sx?")? ?(?:setup)?>([\s\S]+)<\/\1>/)
return result && result[2] ? result[2].trim() : ''
}

function stripStyle (content) {
Expand Down Expand Up @@ -81,7 +81,7 @@ function genInlineComponentText (template, script, id) {
return `const ${s1} = Vue`
})
.replace(/createVNode:_createVNode,?/, '')
.replace(/createTextVNode:_createTextVNode,?/, '')
.replace(/_createTextVNode/g, '__createTextVNode')
.replace(/resolveComponent:_resolveComponent,?/, '')
.replace(/import (.*) from ['"](.*)['"]/g, (s, s1, s2) => `const ${s1} = require('${s2}')`)
.replace(/import ({.*}) from ['"]element-plus['"]/g, (s, s1) => `const ${s1} = require('element-plus')`)
Expand Down

0 comments on commit f6e412a

Please sign in to comment.