Skip to content

Commit 46ca7bc

Browse files
committed
fix(compiler-sfc): avoid deindent when lang is jsx/tsx
fix #12755
1 parent 810f6d1 commit 46ca7bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/compiler-sfc/src/parseComponent.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ export function parseComponent(
179179
let text = source.slice(currentBlock.start, currentBlock.end)
180180
if (
181181
options.deindent === true ||
182-
// by default, deindent unless it's script with default lang or ts
182+
// by default, deindent unless it's script with default lang or (j/t)sx?
183183
(options.deindent !== false &&
184184
!(
185185
currentBlock.type === 'script' &&
186-
(!currentBlock.lang || currentBlock.lang === 'ts')
186+
(!currentBlock.lang || /^(j|t)sx?$/.test(currentBlock.lang))
187187
))
188188
) {
189189
text = deindent(text)

0 commit comments

Comments
 (0)