File tree Expand file tree Collapse file tree 4 files changed +33
-2
lines changed Expand file tree Collapse file tree 4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import {
1919 getSrcDescriptor ,
2020 getTempSrcDescriptor ,
2121} from './utils/descriptorCache'
22- import { clearScriptCache , getResolvedScript , typeDepToSFCMap } from './script'
22+ import { clearScriptCache , resolveScript , typeDepToSFCMap } from './script'
2323import { transformMain } from './main'
2424import { handleHotUpdate , handleTypeDepChange } from './handleHotUpdate'
2525import { transformTemplateAsModule } from './template'
@@ -300,7 +300,12 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
300300 let block : SFCBlock | null | undefined
301301 if ( query . type === 'script' ) {
302302 // 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+ )
304309 } else if ( query . type === 'template' ) {
305310 block = descriptor . template !
306311 } else if ( query . type === 'style' ) {
Original file line number Diff line number Diff line change 1010 </div >
1111 <HmrCircularReference name =" test" />
1212 <TypeProps msg =" msg" bar =" bar" :id =" 123" />
13+ <TypePropsTsx msg =" msg" bar =" bar" />
1314 <Syntax />
1415 <PreProcessors />
1516 <PreProcessorsHmr />
@@ -56,6 +57,7 @@ import WorkerTest from './worker.vue'
5657import { ref } from ' vue'
5758import Url from ' ./Url.vue'
5859import TypeProps from ' ./TypeProps.vue'
60+ import TypePropsTsx from ' ./TypePropsTsx.vue'
5961import DefaultLangs from ' ./DefaultLangs.vue'
6062import PreCompiled from ' ./pre-compiled/foo.vue'
6163import 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', () => {
349349 ) ,
350350 )
351351 } )
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+ } )
352366} )
353367
354368test ( 'TS with generics' , async ( ) => {
You can’t perform that action at this time.
0 commit comments