Skip to content

Commit

Permalink
fix(css): respect esbuild.charset when minify (#13190)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored May 13, 2023
1 parent e640939 commit 4fd35ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1411,8 +1411,7 @@ async function minifyCSS(css: string, config: ResolvedConfig) {
const { code, warnings } = await transform(css, {
loader: 'css',
target: config.build.cssTarget || undefined,
charset: 'utf8',
...resolveEsbuildMinifyOptions(config.esbuild || {}),
...resolveMinifyCssEsbuildOptions(config.esbuild || {}),
})
if (warnings.length) {
const msgs = await formatMessages(warnings, { kind: 'warning' })
Expand All @@ -1432,10 +1431,11 @@ async function minifyCSS(css: string, config: ResolvedConfig) {
}
}

function resolveEsbuildMinifyOptions(
function resolveMinifyCssEsbuildOptions(
options: ESBuildOptions,
): TransformOptions {
const base: TransformOptions = {
charset: options.charset ?? 'utf8',
logLevel: options.logLevel,
logLimit: options.logLimit,
logOverride: options.logOverride,
Expand Down

0 comments on commit 4fd35ed

Please sign in to comment.