Skip to content

Commit

Permalink
fix(css): inject source content conditionally (#12449)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 16, 2023
1 parent c4aa28f commit 3e665f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/plugins/css.ts
Expand Up @@ -377,7 +377,9 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
const getContentWithSourcemap = async (content: string) => {
if (config.css?.devSourcemap) {
const sourcemap = this.getCombinedSourcemap()
await injectSourcesContent(sourcemap, cleanUrl(id), config.logger)
if (sourcemap.mappings && !sourcemap.sourcesContent) {
await injectSourcesContent(sourcemap, cleanUrl(id), config.logger)
}
return getCodeWithSourcemap('css', content, sourcemap)
}
return content
Expand Down

0 comments on commit 3e665f6

Please sign in to comment.