Skip to content

Commit

Permalink
fix(plugin-vue): handle rewrite default edge case with TS
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 24, 2021
1 parent ad6047d commit 5104ee8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/plugin-vue/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,15 @@ async function genScriptCode(
// If the script is js/ts and has no external src, it can be directly placed
// in the main module.
if ((!script.lang || script.lang === 'ts') && !script.src) {
scriptCode = compiler.rewriteDefault(script.content, '_sfc_main')
scriptCode = compiler.rewriteDefault(
script.content,
'_sfc_main',
script.lang === 'ts'
? ['typescript']
: script.lang === 'tsx'
? ['typescript', 'jsx']
: undefined
)
map = script.map
} else {
if (script.src) {
Expand Down

0 comments on commit 5104ee8

Please sign in to comment.