@@ -5,8 +5,9 @@ import evalCode from 'eval';
55import { stringify } from 'javascript-stringify' ;
66import isPlainObject from 'lodash/isPlainObject' ;
77import outdent from 'outdent' ;
8+
89import { hash } from './hash' ;
9- import zlib from 'zlib ' ;
10+ import { serializeCss } from './serialize ' ;
1011
1112const originalNodeEnv = process . env . NODE_ENV ;
1213
@@ -35,7 +36,6 @@ interface ProcessVanillaFileOptions {
3536 identOption ?: IdentifierOption ;
3637 serializeVirtualCssPath ?: ( file : {
3738 fileName : string ;
38- base64Source : string ;
3939 fileScope : FileScope ;
4040 source : string ;
4141 } ) => string | Promise < string > ;
@@ -110,9 +110,6 @@ export async function processVanillaFile({
110110 cssObjs : fileScopeCss ,
111111 } ) . join ( '\n' ) ;
112112
113- const compressedCSS = zlib . gzipSync ( css ) ;
114- const base64Source = compressedCSS . toString ( 'base64' ) ;
115-
116113 const fileName = `${
117114 fileScope . packageName
118115 ? `${ fileScope . packageName } /${ fileScope . filePath } `
@@ -124,7 +121,6 @@ export async function processVanillaFile({
124121 if ( serializeVirtualCssPath ) {
125122 const serializedResult = serializeVirtualCssPath ( {
126123 fileName,
127- base64Source,
128124 fileScope,
129125 source : css ,
130126 } ) ;
@@ -135,7 +131,9 @@ export async function processVanillaFile({
135131 virtualCssFilePath = await serializedResult ;
136132 }
137133 } else {
138- virtualCssFilePath = `import '${ fileName } ?source=${ base64Source } ';` ;
134+ const serializedCss = await serializeCss ( css ) ;
135+
136+ virtualCssFilePath = `import '${ fileName } ?source=${ serializedCss } ';` ;
139137 }
140138
141139 cssImports . push ( virtualCssFilePath ) ;
0 commit comments