File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11import { Buffer } from 'node:buffer'
22import { readFile } from 'node:fs/promises'
3- import { transform } from 'lightningcss'
43import type { Options } from './options'
54
65const postfixRE = / [ # ? ] .* $ / s
76function cleanUrl ( url : string ) : string {
87 return url . replace ( postfixRE , '' )
98}
109
11- export function transformCss (
10+ export async function transformCss (
1211 id : string ,
1312 code : string ,
1413 options : Options [ 'options' ] ,
15- ) : { code : string ; map ?: string } {
14+ ) : Promise < { code : string ; map ?: string } > {
1615 const filename = cleanUrl ( id )
16+ const { transform } = await import ( 'lightningcss' )
1717 const res = transform ( {
1818 ...options ,
1919 filename,
@@ -32,6 +32,7 @@ export async function transformCssModule(
3232 const actualId = id . replace ( / \? c s s _ m o d u l e $ / , '' )
3333 const code = await readFile ( actualId , 'utf-8' )
3434 const filename = cleanUrl ( actualId )
35+ const { transform } = await import ( 'lightningcss' )
3536 const res = transform ( {
3637 cssModules : true ,
3738 ...options ,
You can’t perform that action at this time.
0 commit comments