diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 2ac6d5b8..3d547040 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -19,7 +19,7 @@ import { getSrcDescriptor, getTempSrcDescriptor, } from './utils/descriptorCache' -import { clearScriptCache, getResolvedScript, typeDepToSFCMap } from './script' +import { clearScriptCache, resolveScript, typeDepToSFCMap } from './script' import { transformMain } from './main' import { handleHotUpdate, handleTypeDepChange } from './handleHotUpdate' import { transformTemplateAsModule } from './template' @@ -300,7 +300,12 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { let block: SFCBlock | null | undefined if (query.type === 'script') { // handle + + diff --git a/playground/vue/__tests__/vue.spec.ts b/playground/vue/__tests__/vue.spec.ts index aa88ec19..eb0af361 100644 --- a/playground/vue/__tests__/vue.spec.ts +++ b/playground/vue/__tests__/vue.spec.ts @@ -349,6 +349,20 @@ describe('macro imported types', () => { ), ) }) + + test('should hmr with lang=tsx', async () => { + editFile('types.ts', (code) => code.replace('msg: string', '')) + await untilUpdated( + () => page.textContent('.type-props-tsx'), + JSON.stringify( + { + bar: 'bar', + }, + null, + 2, + ), + ) + }) }) test('TS with generics', async () => {