Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8e4e932

Browse filesBrowse files
easymikeyМихаил Авдеев
and
Михаил Авдеев
authored
fix(css): handle lightningcss compiled css in Deno (#17301)
Co-authored-by: Михаил Авдеев <mikhail.avdeev@vk.team>
1 parent 4a89766 commit 8e4e932
Copy full SHA for 8e4e932

File tree

1 file changed

+5
-1
lines changed
Filter options
  • packages/vite/src/node/plugins

1 file changed

+5
-1
lines changed

‎packages/vite/src/node/plugins/css.ts

Copy file name to clipboardExpand all lines: packages/vite/src/node/plugins/css.ts
+5-1
Original file line numberDiff line numberDiff line change
@@ -2695,6 +2695,7 @@ function isPreProcessor(lang: any): lang is PreprocessLang {
26952695

26962696
const importLightningCSS = createCachedImport(() => import('lightningcss'))
26972697

2698+
const decoder = new TextDecoder()
26982699
async function compileLightningCSS(
26992700
id: string,
27002701
src: string,
@@ -2760,7 +2761,10 @@ async function compileLightningCSS(
27602761
: undefined,
27612762
})
27622763

2763-
let css = res.code.toString()
2764+
// NodeJS res.code = Buffer
2765+
// Deno res.code = Uint8Array
2766+
// For correct decode compiled css need to use TextDecoder
2767+
let css = decoder.decode(res.code)
27642768
for (const dep of res.dependencies!) {
27652769
switch (dep.type) {
27662770
case 'url':

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.