From f2d1d29bcab9210cdbfd8e507eeffe033c714bc3 Mon Sep 17 00:00:00 2001 From: Jevon <1787176370@qq.com> Date: Tue, 22 Nov 2022 22:29:56 +0800 Subject: [PATCH] fix(plugin-vue): support scss/sass/less... hmr on custom template languages (fix #10677) (#10844) --- packages/plugin-vue/src/handleHotUpdate.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue/src/handleHotUpdate.ts b/packages/plugin-vue/src/handleHotUpdate.ts index d1d4ae9f..5569f0df 100644 --- a/packages/plugin-vue/src/handleHotUpdate.ts +++ b/packages/plugin-vue/src/handleHotUpdate.ts @@ -1,6 +1,8 @@ import _debug from 'debug' import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' import type { HmrContext, ModuleNode } from 'vite' +import { isCSSRequest } from 'vite' + import { createDescriptor, getDescriptor, @@ -153,7 +155,7 @@ export async function handleHotUpdate( affectedModules.add(mainModule) } else if (mainModule && !affectedModules.has(mainModule)) { const styleImporters = [...mainModule.importers].filter((m) => - /\.css(?:$|\?)/.test(m.url) + isCSSRequest(m.url) ) styleImporters.forEach((m) => affectedModules.add(m)) }