Skip to content

Commit 6ffee6d

Browse files
committed
fix(plugin-vue): handle custom element when hot update
1 parent 8c694f6 commit 6ffee6d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/plugin-vue/src/handleHotUpdate.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const directRequestRE = /(?:\?|&)direct\b/
3030
export async function handleHotUpdate(
3131
{ file, modules, read }: HmrContext,
3232
options: ResolvedOptions,
33+
customElement: boolean,
3334
): Promise<ModuleNode[] | void> {
3435
const prevDescriptor = getDescriptor(file, options, false, true)
3536
if (!prevDescriptor) {
@@ -46,7 +47,7 @@ export async function handleHotUpdate(
4647
const templateModule = modules.find((m) => /type=template/.test(m.url))
4748

4849
// trigger resolveScript for descriptor so that we'll have the AST ready
49-
resolveScript(descriptor, options, false)
50+
resolveScript(descriptor, options, false, customElement)
5051
const scriptChanged = hasScriptChanged(prevDescriptor, descriptor)
5152
if (scriptChanged) {
5253
affectedModules.add(getScriptModule(modules) || mainModule)

packages/plugin-vue/src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
137137
return handleTypeDepChange(typeDepToSFCMap.get(ctx.file)!, ctx)
138138
}
139139
if (filter.value(ctx.file)) {
140-
return handleHotUpdate(ctx, options.value)
140+
return handleHotUpdate(
141+
ctx,
142+
options.value,
143+
customElementFilter.value(ctx.file),
144+
)
141145
}
142146
},
143147

0 commit comments

Comments
 (0)