@@ -14,6 +14,7 @@ import {
14
14
removeLeadingSlash ,
15
15
removeTrailingSlash ,
16
16
} from '@rspress/shared' ;
17
+ import { pluginVirtualModule } from 'rsbuild-plugin-virtual-module' ;
17
18
import type { PluginDriver } from './PluginDriver' ;
18
19
import {
19
20
CLIENT_ENTRY ,
@@ -28,7 +29,8 @@ import {
28
29
import { hintThemeBreakingChange } from './logger/hint' ;
29
30
import type { RouteService } from './route/RouteService' ;
30
31
import { initRouteService } from './route/init' ;
31
- import { rsbuildPluginDocVM } from './runtimeModule' ;
32
+ import { type FactoryContext , rsbuildPluginDocVM } from './runtimeModule' ;
33
+ import { i18nVMPlugin } from './runtimeModule/i18n' ;
32
34
import { serveSearchIndexMiddleware } from './searchIndex' ;
33
35
import { detectReactVersion , resolveReactAlias } from './utils' ;
34
36
import { detectCustomIcon } from './utils/detectCustomIcon' ;
@@ -95,15 +97,21 @@ async function createInternalBuildConfig(
95
97
enableSSG ? resolveReactAlias ( reactVersion , true ) : Promise . resolve ( { } ) ,
96
98
] ) ;
97
99
100
+ const context : Omit < FactoryContext , 'isSSR' | 'alias' > = {
101
+ userDocRoot,
102
+ config,
103
+ runtimeTempDir,
104
+ routeService,
105
+ pluginDriver,
106
+ } ;
98
107
return {
99
108
plugins : [
100
109
...( isPluginIncluded ( config , PLUGIN_REACT_NAME ) ? [ ] : [ pluginReact ( ) ] ) ,
101
- rsbuildPluginDocVM ( {
102
- userDocRoot,
103
- config,
104
- runtimeTempDir,
105
- routeService,
106
- pluginDriver,
110
+ rsbuildPluginDocVM ( context ) ,
111
+ pluginVirtualModule ( {
112
+ virtualModules : {
113
+ ...i18nVMPlugin ( context ) ,
114
+ } ,
107
115
} ) ,
108
116
] ,
109
117
server : {
0 commit comments