Skip to content

Commit

Permalink
fix: setup jsx script no hmr
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Mar 1, 2022
1 parent de54d48 commit 582dfdd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/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 582dfdd

Please sign in to comment.