Skip to content

Commit

Permalink
fix(hmr): re-resolve script after type dep changed
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Sep 19, 2024
1 parent 8d5a270 commit 457897e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ import {
getSrcDescriptor,
getTempSrcDescriptor,
} from './utils/descriptorCache'
import { clearScriptCache, getResolvedScript, typeDepToSFCMap } from './script'
import {
clearScriptCache,
getResolvedScript,
resolveScript,
typeDepToSFCMap,
} from './script'
import { transformMain } from './main'
import { handleHotUpdate, handleTypeDepChange } from './handleHotUpdate'
import { transformTemplateAsModule } from './template'
Expand Down Expand Up @@ -301,6 +306,13 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
if (query.type === 'script') {
// handle <script> + <script setup> merge via compileScript()
block = getResolvedScript(descriptor, ssr)
if (!block)
block = resolveScript(
descriptor,
options.value,
ssr,
customElementFilter.value(filename),
)
} else if (query.type === 'template') {
block = descriptor.template!
} else if (query.type === 'style') {
Expand Down

0 comments on commit 457897e

Please sign in to comment.