Skip to content

Commit d413848

Browse files
authoredNov 22, 2022
fix(plugin-vue): support scss/sass/less... hmr on custom template languages (fix #10677) (#10844)
1 parent 8148af7 commit d413848

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎packages/plugin-vue/src/handleHotUpdate.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import _debug from 'debug'
22
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
33
import type { HmrContext, ModuleNode } from 'vite'
4+
import { isCSSRequest } from 'vite'
5+
46
import {
57
createDescriptor,
68
getDescriptor,
@@ -153,7 +155,7 @@ export async function handleHotUpdate(
153155
affectedModules.add(mainModule)
154156
} else if (mainModule && !affectedModules.has(mainModule)) {
155157
const styleImporters = [...mainModule.importers].filter((m) =>
156-
/\.css(?:$|\?)/.test(m.url)
158+
isCSSRequest(m.url)
157159
)
158160
styleImporters.forEach((m) => affectedModules.add(m))
159161
}

‎packages/vite/src/node/publicUtils.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export { version as esbuildVersion } from 'esbuild'
88
export { VERSION as rollupVersion } from 'rollup'
99
export {
1010
splitVendorChunkPlugin,
11-
splitVendorChunk
11+
splitVendorChunk,
12+
isCSSRequest
1213
} from './plugins/splitVendorChunk'
1314
export { normalizePath, mergeConfig, mergeAlias, createFilter } from './utils'
1415
export { send } from './server/send'

0 commit comments

Comments
 (0)
Please sign in to comment.