diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 7485d917440a8f..2a1fe17556c258 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -652,11 +652,13 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { } return true }) - chunk.code = chunk.code.replace( - emptyChunkRE, - // remove css import while preserving source map location - (m) => `/* empty css ${''.padEnd(m.length - 15)}*/` - ) + if (opts.format !== 'system') { + chunk.code = chunk.code.replace( + emptyChunkRE, + // remove css import while preserving source map location + (m) => `/* empty css ${''.padEnd(m.length - 15)}*/` + ) + } } } const removedPureCssFiles = removedPureCssFilesCache.get(config)!