File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed
Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export const rawstyleTurboRule: Required<Required<NextConfig>['turbopack']>['rul
1111
1212export default function ( this : { resourcePath : string } , source : string ) : string {
1313 const { transformed, css } = transform ( this . resourcePath , source )
14+ if ( ! css ) return transformed
1415 const base64Css = Buffer . from ( css , 'utf8' ) . toString ( 'base64' )
1516 return `import 'data:text/css;base64,${ base64Css } ';${ transformed } `
1617}
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export default (): Plugin => ({
2424 transform ( code , id ) {
2525 if ( ! TRANSFORMABLE_EXT . test ( id ) ) return
2626 const { transformed, css } = transform ( id , code )
27+ if ( ! css ) return transformed
2728 const cssId = normalizePath ( id + '.css' )
2829 styles . set ( cssId , css )
2930 return `import '${ VIRTUAL_PREFIX } ${ cssId } ';${ transformed } `
@@ -33,6 +34,7 @@ export default (): Plugin => ({
3334 if ( ! TRANSFORMABLE_EXT . test ( file ) ) return
3435 const sourceCode = await read ( )
3536 const { css } = transform ( file , sourceCode )
37+ if ( ! css ) return
3638 const cssId = normalizePath ( file + '.css' )
3739 const virtualId = RESOLVED_PREFIX + cssId
3840 const mod = server . moduleGraph . getModuleById ( virtualId )
You can’t perform that action at this time.
0 commit comments