mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): fix prefixIdentifier default value
This commit is contained in:
parent
fe008152c0
commit
3d6f01571b
|
@ -234,3 +234,19 @@ test('namespace / dot component usage', () => {
|
||||||
expect(content).toMatch('return { get Foo() { return Foo } }')
|
expect(content).toMatch('return { get Foo() { return Foo } }')
|
||||||
assertCode(content)
|
assertCode(content)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('check when has explicit parse options', () => {
|
||||||
|
const { content } = compile(
|
||||||
|
`
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { x } from './x'
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
{{ x }}
|
||||||
|
</template>
|
||||||
|
`,
|
||||||
|
undefined,
|
||||||
|
{ templateParseOptions: {} },
|
||||||
|
)
|
||||||
|
expect(content).toMatch('return { get x() { return x } }')
|
||||||
|
})
|
||||||
|
|
|
@ -133,7 +133,7 @@ export function parse(
|
||||||
pad = false,
|
pad = false,
|
||||||
ignoreEmpty = true,
|
ignoreEmpty = true,
|
||||||
compiler = CompilerDOM,
|
compiler = CompilerDOM,
|
||||||
templateParseOptions = { prefixIdentifiers: true },
|
templateParseOptions = {},
|
||||||
} = options
|
} = options
|
||||||
|
|
||||||
const descriptor: SFCDescriptor = {
|
const descriptor: SFCDescriptor = {
|
||||||
|
@ -152,6 +152,7 @@ export function parse(
|
||||||
const errors: (CompilerError | SyntaxError)[] = []
|
const errors: (CompilerError | SyntaxError)[] = []
|
||||||
const ast = compiler.parse(source, {
|
const ast = compiler.parse(source, {
|
||||||
parseMode: 'sfc',
|
parseMode: 'sfc',
|
||||||
|
prefixIdentifiers: true,
|
||||||
...templateParseOptions,
|
...templateParseOptions,
|
||||||
onError: e => {
|
onError: e => {
|
||||||
errors.push(e)
|
errors.push(e)
|
||||||
|
|
Loading…
Reference in New Issue