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 committed Oct 27, 2021
1 parent 79c2a49 commit 4331c26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/plugin-vue/src/handleHotUpdate.ts
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 4331c26

Please sign in to comment.