File tree 4 files changed +33
-2
lines changed
4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import {
19
19
getSrcDescriptor ,
20
20
getTempSrcDescriptor ,
21
21
} from './utils/descriptorCache'
22
- import { clearScriptCache , getResolvedScript , typeDepToSFCMap } from './script'
22
+ import { clearScriptCache , resolveScript , typeDepToSFCMap } from './script'
23
23
import { transformMain } from './main'
24
24
import { handleHotUpdate , handleTypeDepChange } from './handleHotUpdate'
25
25
import { transformTemplateAsModule } from './template'
@@ -300,7 +300,12 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
300
300
let block : SFCBlock | null | undefined
301
301
if ( query . type === 'script' ) {
302
302
// handle <script> + <script setup> merge via compileScript()
303
- block = getResolvedScript ( descriptor , ssr )
303
+ block = resolveScript (
304
+ descriptor ,
305
+ options . value ,
306
+ ssr ,
307
+ customElementFilter . value ( filename ) ,
308
+ )
304
309
} else if ( query . type === 'template' ) {
305
310
block = descriptor . template !
306
311
} else if ( query . type === 'style' ) {
Original file line number Diff line number Diff line change 10
10
</div >
11
11
<HmrCircularReference name =" test" />
12
12
<TypeProps msg =" msg" bar =" bar" :id =" 123" />
13
+ <TypePropsTsx msg =" msg" bar =" bar" />
13
14
<Syntax />
14
15
<PreProcessors />
15
16
<PreProcessorsHmr />
@@ -56,6 +57,7 @@ import WorkerTest from './worker.vue'
56
57
import { ref } from ' vue'
57
58
import Url from ' ./Url.vue'
58
59
import TypeProps from ' ./TypeProps.vue'
60
+ import TypePropsTsx from ' ./TypePropsTsx.vue'
59
61
import DefaultLangs from ' ./DefaultLangs.vue'
60
62
import PreCompiled from ' ./pre-compiled/foo.vue'
61
63
import PreCompiledExternalScoped from ' ./pre-compiled/external-scoped.vue'
Original file line number Diff line number Diff line change
1
+ <script setup lang="tsx">
2
+ import type { Props } from ' ./types'
3
+
4
+ const props = defineProps <Props & { bar: string }>()
5
+ </script >
6
+
7
+ <template >
8
+ <h2 >Imported Type Props</h2 >
9
+ <pre class =" type-props-tsx" >{{ props }}</pre >
10
+ </template >
Original file line number Diff line number Diff line change @@ -349,6 +349,20 @@ describe('macro imported types', () => {
349
349
) ,
350
350
)
351
351
} )
352
+
353
+ test ( 'should hmr with lang=tsx' , async ( ) => {
354
+ editFile ( 'types.ts' , ( code ) => code . replace ( 'msg: string' , '' ) )
355
+ await untilUpdated (
356
+ ( ) => page . textContent ( '.type-props-tsx' ) ,
357
+ JSON . stringify (
358
+ {
359
+ bar : 'bar' ,
360
+ } ,
361
+ null ,
362
+ 2 ,
363
+ ) ,
364
+ )
365
+ } )
352
366
} )
353
367
354
368
test ( 'TS with generics' , async ( ) => {
You can’t perform that action at this time.
0 commit comments