Skip to content

Commit

Permalink
fix(plugin-vue): setup jsx script no hmr (#6568)
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho authored Feb 23, 2022
1 parent 6a3c4e7 commit 154440e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/plugin-vue/src/handleHotUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ export async function handleHotUpdate(

if (hasScriptChanged(prevDescriptor, descriptor)) {
let scriptModule: ModuleNode | undefined
if (descriptor.script?.lang && !descriptor.script.src) {
if (
(descriptor.scriptSetup?.lang && !descriptor.scriptSetup.src) ||
(descriptor.script?.lang && !descriptor.script.src)
) {
const scriptModuleRE = new RegExp(
`type=script.*&lang\.${descriptor.script.lang}$`
`type=script.*&lang\.${
descriptor.scriptSetup?.lang || descriptor.script?.lang
}$`
)
scriptModule = modules.find((m) => scriptModuleRE.test(m.url))
}
Expand Down

0 comments on commit 154440e

Please sign in to comment.