Skip to content

Commit 3e665f6

Browse files
authored
fix(css): inject source content conditionally (#12449)
1 parent c4aa28f commit 3e665f6

File tree

1 file changed

+3
-1
lines changed
  • packages/vite/src/node/plugins

1 file changed

+3
-1
lines changed

packages/vite/src/node/plugins/css.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
377377
const getContentWithSourcemap = async (content: string) => {
378378
if (config.css?.devSourcemap) {
379379
const sourcemap = this.getCombinedSourcemap()
380-
await injectSourcesContent(sourcemap, cleanUrl(id), config.logger)
380+
if (sourcemap.mappings && !sourcemap.sourcesContent) {
381+
await injectSourcesContent(sourcemap, cleanUrl(id), config.logger)
382+
}
381383
return getCodeWithSourcemap('css', content, sourcemap)
382384
}
383385
return content

0 commit comments

Comments
 (0)