File tree Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,30 @@ This section describes all the properties and methods on the Rsbuild instance ob
44
55## rsbuild.context  
66
7- ` rsbuild.context `  is a read-only object that provides some context information.
7+ ` rsbuild.context `  is a read-only object that provides some context information, which can be accessed in two ways:
8+ 
9+ 1 .  Access through the ` context `  property of the Rsbuild instance:
10+ 
11+ ``` ts 
12+ import  { createRsbuild  } from  ' @rsbuild/core'  ;
13+ 
14+ const   rsbuild =  createRsbuild ({
15+   //  ...
16+ });
17+ 
18+ console .log (rsbuild .context );
19+ ``` 
20+ 
21+ 2 .  Access through the [ api.context] ( /plugins/dev/core#apicontext )  of the Rsbuild plugin:
22+ 
23+ ``` ts 
24+ export   const   myPlugin =  {
25+   name: ' my-plugin'  ,
26+   setup(api ) {
27+     console .log (api .context );
28+   },
29+ };
30+ ``` 
831
932### context.version  
1033
Original file line number Diff line number Diff line change 44
55## rsbuild.context  
66
7- ` rsbuild.context `  是一个只读对象,提供一些上下文信息。
7+ ` context `  是一个只读对象,提供一些上下文信息,能够通过两种方式访问:
8+ 
9+ 1 .  通过 Rsbuild 实例的 ` context `  属性访问:
10+ 
11+ ``` ts 
12+ import  { createRsbuild  } from  ' @rsbuild/core'  ;
13+ 
14+ const   rsbuild =  createRsbuild ({
15+   //  ...
16+ });
17+ 
18+ console .log (rsbuild .context );
19+ ``` 
20+ 
21+ 2 .  通过 Rsbuild 插件的 [ api.context] ( /plugins/dev/core#apicontext )  访问:
22+ 
23+ ``` ts 
24+ export   const   myPlugin =  {
25+   name: ' my-plugin'  ,
26+   setup(api ) {
27+     console .log (api .context );
28+   },
29+ };
30+ ``` 
831
932### context.version  
1033
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments