Skip to content

Commit

Permalink
fix(plugin-vue): exclude direct css request from hmr target (#5422)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Oct 27, 2021
1 parent df59ff9 commit 16aa887
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/plugin-vue/src/handleHotUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { ResolvedOptions } from '.'

const debug = _debug('vite:hmr')

const directRequestRE = /(\?|&)direct\b/

/**
* Vite-specific HMR handling
*/
Expand Down Expand Up @@ -92,7 +94,8 @@ export async function handleHotUpdate(
const mod = modules.find(
(m) =>
m.url.includes(`type=style&index=${i}`) &&
m.url.endsWith(`.${next.lang || 'css'}`)
m.url.endsWith(`.${next.lang || 'css'}`) &&
!directRequestRE.test(m.url)
)
if (mod) {
affectedModules.add(mod)
Expand Down

0 comments on commit 16aa887

Please sign in to comment.