From e0463bd64de548e215a31ddf0f2c4bb3ef044e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Fri, 21 Oct 2022 17:48:50 +0900 Subject: [PATCH] fix(css): strip BOM (fixes #10043) (#10577) --- packages/vite/src/node/plugins/css.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 194259ba0e6c96..bdef18f08980ae 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -43,7 +43,8 @@ import { parseRequest, processSrcSet, removeDirectQuery, - requireResolveFromRootWithFallback + requireResolveFromRootWithFallback, + stripBomTag } from '../utils' import type { Logger } from '../logger' import { addToHTMLProxyTransformResult } from './html' @@ -353,6 +354,8 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { return } + css = stripBomTag(css) + const inlined = inlineRE.test(id) const modules = cssModulesCache.get(config)!.get(id)