Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
fix: fix preamble injection
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 21, 2020
1 parent 34e3aa8 commit 027c4a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/serverPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export default exports
await next()

if ((ctx.path.endsWith('/') || ctx.path.endsWith('.html')) && ctx.body) {
// inject global preamble
ctx.body = globalPreamble + ctx.body
// inject react-refresh global preamble after the vite built-in preamble
ctx.body = ctx.body.replace('</script>', `</script>${globalPreamble}`)
}
})
}

0 comments on commit 027c4a5

Please sign in to comment.