44 type EnvironmentConfig ,
55 type RsbuildConfig ,
66 type RsbuildPlugin ,
7+ type RsbuildPlugins ,
78 defineConfig as defineRsbuildConfig ,
89 loadConfig as loadRsbuildConfig ,
910 mergeRsbuildConfig ,
@@ -1143,8 +1144,11 @@ const composeExternalHelpersConfig = (
11431144 return defaultConfig ;
11441145} ;
11451146
1146- async function composeLibRsbuildConfig ( config : LibConfig ) {
1147- checkMFPlugin ( config ) ;
1147+ async function composeLibRsbuildConfig (
1148+ config : LibConfig ,
1149+ sharedPlugins ?: RsbuildPlugins ,
1150+ ) {
1151+ checkMFPlugin ( config , sharedPlugins ) ;
11481152
11491153 // Get the absolute path of the root directory to align with Rsbuild's default behavior
11501154 const rootPath = config . root
@@ -1258,7 +1262,11 @@ export async function composeCreateRsbuildConfig(
12581262 rslibConfig : RslibConfig ,
12591263) : Promise < RsbuildConfigWithLibInfo [ ] > {
12601264 const constantRsbuildConfig = await createConstantRsbuildConfig ( ) ;
1261- const { lib : libConfigsArray , plugins, ...sharedRsbuildConfig } = rslibConfig ;
1265+ const {
1266+ lib : libConfigsArray ,
1267+ plugins : sharedPlugins ,
1268+ ...sharedRsbuildConfig
1269+ } = rslibConfig ;
12621270
12631271 if ( ! libConfigsArray ) {
12641272 throw new Error (
@@ -1274,7 +1282,10 @@ export async function composeCreateRsbuildConfig(
12741282
12751283 // Merge the configuration of each environment based on the shared Rsbuild
12761284 // configuration and Lib configuration in the settings.
1277- const libRsbuildConfig = await composeLibRsbuildConfig ( userConfig ) ;
1285+ const libRsbuildConfig = await composeLibRsbuildConfig (
1286+ userConfig ,
1287+ sharedPlugins ,
1288+ ) ;
12781289
12791290 // Reset certain fields because they will be completely overridden by the upcoming merge.
12801291 // We don't want to retain them in the final configuration.
0 commit comments