fix(compiler-sfc): avoid script setup marker showing up in devtools
This commit is contained in:
parent
2e10261b38
commit
211793d376
@ -1121,15 +1121,22 @@ export function compileScript(
|
|||||||
allBindings[key] = true
|
allBindings[key] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const keys = Object.keys(allBindings)
|
returned = `{ ${Object.keys(allBindings).join(', ')} }`
|
||||||
if (!__TEST__) {
|
}
|
||||||
// the `__isScriptSetup: true` flag is used by componentPublicInstance
|
|
||||||
// proxy to allow properties that start with $ or _
|
if (!options.inlineTemplate && !__TEST__) {
|
||||||
keys.push(`__isScriptSetup: true`)
|
// in non-inline mode, the `__isScriptSetup: true` flag is used by
|
||||||
}
|
// componentPublicInstance proxy to allow properties that start with $ or _
|
||||||
returned = `{ ${keys.join(', ')} }`
|
s.appendRight(
|
||||||
|
endOffset,
|
||||||
|
`\nconst __returned__ = ${returned}\n` +
|
||||||
|
`Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\n` +
|
||||||
|
`return __returned__` +
|
||||||
|
`\n}\n\n`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`)
|
||||||
}
|
}
|
||||||
s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`)
|
|
||||||
|
|
||||||
// 11. finalize default export
|
// 11. finalize default export
|
||||||
let runtimeOptions = ``
|
let runtimeOptions = ``
|
||||||
|
Loading…
Reference in New Issue
Block a user