Skip to content

Commit 5104ee8

Browse files
committed
fix(plugin-vue): handle rewrite default edge case with TS
ref vuejs/core#4673
1 parent ad6047d commit 5104ee8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/plugin-vue/src/main.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,15 @@ async function genScriptCode(
272272
// If the script is js/ts and has no external src, it can be directly placed
273273
// in the main module.
274274
if ((!script.lang || script.lang === 'ts') && !script.src) {
275-
scriptCode = compiler.rewriteDefault(script.content, '_sfc_main')
275+
scriptCode = compiler.rewriteDefault(
276+
script.content,
277+
'_sfc_main',
278+
script.lang === 'ts'
279+
? ['typescript']
280+
: script.lang === 'tsx'
281+
? ['typescript', 'jsx']
282+
: undefined
283+
)
276284
map = script.map
277285
} else {
278286
if (script.src) {

0 commit comments

Comments
 (0)