Skip to content

Commit

Permalink
fix(compiler-sfc): avoid deindent when lang is jsx/tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 23, 2022
1 parent 810f6d1 commit 46ca7bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/compiler-sfc/src/parseComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ export function parseComponent(
let text = source.slice(currentBlock.start, currentBlock.end)
if (
options.deindent === true ||
// by default, deindent unless it's script with default lang or ts
// by default, deindent unless it's script with default lang or (j/t)sx?
(options.deindent !== false &&
!(
currentBlock.type === 'script' &&
(!currentBlock.lang || currentBlock.lang === 'ts')
(!currentBlock.lang || /^(j|t)sx?$/.test(currentBlock.lang))
))
) {
text = deindent(text)
Expand Down

0 comments on commit 46ca7bc

Please sign in to comment.