File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed 
packages/vite/src/node/plugins Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818  CLIENT_PUBLIC_PATH , 
1919  DEP_VERSION_RE , 
2020  FS_PREFIX , 
21+   SPECIAL_QUERY_RE , 
2122}  from  '../constants' 
2223import  { 
2324  debugHmr , 
@@ -743,7 +744,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
743744      // update the module graph for HMR analysis. 
744745      // node CSS imports does its own graph update in the css-analysis plugin so we 
745746      // only handle js graph updates here. 
746-       if  ( ! isCSSRequest ( importer ) )  { 
747+       // note that we want to handle .css?raw and .css?url here 
748+       if  ( ! isCSSRequest ( importer )  ||  SPECIAL_QUERY_RE . test ( importer ) )  { 
747749        // attached by pluginContainer.addWatchFile 
748750        const  pluginImports  =  ( this  as  any ) . _addedImports  as 
749751          |  Set < string > 
Original file line number Diff line number Diff line change @@ -448,6 +448,16 @@ test('?raw', async () => {
448448  expect ( await  rawImportCss . textContent ( ) ) . toBe ( 
449449    readFileSync ( require . resolve ( '../raw-imported.css' ) ,  'utf-8' ) , 
450450  ) 
451+ 
452+   if  ( ! isBuild )  { 
453+     editFile ( 'raw-imported.css' ,  ( code )  => 
454+       code . replace ( 'color: yellow' ,  'color: blue' ) , 
455+     ) 
456+     await  untilUpdated ( 
457+       ( )  =>  page . textContent ( '.raw-imported-css' ) , 
458+       'color: blue' , 
459+     ) 
460+   } 
451461} ) 
452462
453463test ( 'import css in less' ,  async  ( )  =>  { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments