Skip to content

Commit

Permalink
fix: avoid adding h to pragmas in vue3
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Jan 18, 2022
1 parent 797d434 commit bb265cb
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { transform, TransformOptions } from 'buble'
import * as Vue from 'vue'
import walkes from 'walkes'
import { isCodeVueSfc } from 'vue-inbrowser-compiler-utils'
import transformOneImport from './transformOneImport'
Expand All @@ -11,6 +12,8 @@ import normalizeSfcComponent, {
import getAst from './getAst'
import getTargetFromBrowser from './getTargetFromBrowser'

const isVue3 = !!(Vue as any).h

interface EvaluableComponent {
script: string
template?: string
Expand Down Expand Up @@ -83,7 +86,7 @@ function prepareVueCodeForEvalFunction(code: string, config: any): EvaluableComp
: undefined
const renderIndex = getRenderFunctionStart(optionsNode)
let endIndex = optionsNode.end
if (renderIndex > 0) {
if (renderIndex > 0 && !isVue3) {
code = insertCreateElementFunction(
code.slice(0, renderIndex + 1),
code.slice(renderIndex + 1)
Expand Down

0 comments on commit bb265cb

Please sign in to comment.