File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
packages/webpack-plugin/src Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ describe('devupUILoader', () => {
3737 code : 'code' ,
3838 css : 'css' ,
3939 free : vi . fn ( ) ,
40- map : undefined ,
40+ map : '{}' ,
4141 } )
4242 devupUILoader . bind ( t as any ) ( Buffer . from ( 'code' ) , 'index.tsx' )
4343
@@ -49,7 +49,7 @@ describe('devupUILoader', () => {
4949 'cssFile' ,
5050 )
5151 await vi . waitFor ( ( ) => {
52- expect ( t . async ( ) ) . toHaveBeenCalledWith ( null , 'code' , undefined )
52+ expect ( t . async ( ) ) . toHaveBeenCalledWith ( null , 'code' , { } )
5353 } )
5454 expect ( writeFile ) . toHaveBeenCalledWith ( 'cssFile' , '/* index.tsx 0 */' )
5555 expect ( writeFile ) . toHaveBeenCalledWith ( 'sheetFile' , 'sheet' )
@@ -84,7 +84,7 @@ describe('devupUILoader', () => {
8484 'package' ,
8585 'cssFile' ,
8686 )
87- expect ( t . async ( ) ) . toHaveBeenCalledWith ( null , 'code' , undefined )
87+ expect ( t . async ( ) ) . toHaveBeenCalledWith ( null , 'code' , null )
8888 expect ( writeFile ) . not . toHaveBeenCalledWith ( 'cssFile' , 'css' , {
8989 encoding : 'utf-8' ,
9090 } )
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions> =
3131 libPackage ,
3232 relative ( dirname ( this . resourcePath ) , cssFile ) . replaceAll ( '\\' , '/' ) ,
3333 )
34+ const sourceMap = map ? JSON . parse ( map ) : null
3435 if ( css && watch ) {
3536 const content = `${ this . resourcePath } ${ Date . now ( ) } `
3637 if ( this . _compiler ) ( this . _compiler as any ) . __DEVUP_CACHE = content
@@ -41,10 +42,10 @@ const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions> =
4142 writeFile ( classMapFile , exportClassMap ( ) ) ,
4243 ] )
4344 . catch ( console . error )
44- . finally ( ( ) => callback ( null , code , map ? JSON . parse ( map ) : null ) )
45+ . finally ( ( ) => callback ( null , code , sourceMap ) )
4546 return
4647 }
47- callback ( null , code , map ? JSON . parse ( map ) : null )
48+ callback ( null , code , sourceMap )
4849 } catch ( error ) {
4950 callback ( error as Error )
5051 }
You can’t perform that action at this time.
0 commit comments