Commit b3f5bd1 1 parent 6fbb5e0 commit b3f5bd1 Copy full SHA for b3f5bd1
File tree 1 file changed +6
-3
lines changed
packages/vite/src/node/plugins
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ import {
83
83
import type { ESBuildOptions } from './esbuild'
84
84
import { getChunkOriginalFileName } from './manifest'
85
85
86
+ const decoder = new TextDecoder ( )
86
87
// const debug = createDebugger('vite:css')
87
88
88
89
export interface CSSOptions {
@@ -1808,8 +1809,12 @@ async function minifyCSS(
1808
1809
) ,
1809
1810
)
1810
1811
}
1812
+
1813
+ // NodeJS res.code = Buffer
1814
+ // Deno res.code = Uint8Array
1815
+ // For correct decode compiled css need to use TextDecoder
1811
1816
// LightningCSS output does not return a linebreak at the end
1812
- return code . toString ( ) + ( inlined ? '' : '\n' )
1817
+ return decoder . decode ( code ) + ( inlined ? '' : '\n' )
1813
1818
}
1814
1819
try {
1815
1820
const { code, warnings } = await transform ( css , {
@@ -2698,8 +2703,6 @@ function isPreProcessor(lang: any): lang is PreprocessLang {
2698
2703
}
2699
2704
2700
2705
const importLightningCSS = createCachedImport ( ( ) => import ( 'lightningcss' ) )
2701
-
2702
- const decoder = new TextDecoder ( )
2703
2706
async function compileLightningCSS (
2704
2707
id : string ,
2705
2708
src : string ,
You can’t perform that action at this time.
0 commit comments