File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
packages/rsbuild-plugin/src/cli Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/rsbuild-plugin ' : patch
3
+ ---
4
+
5
+ fix(rsbuild-plugin): remove duplicate logs for shared modules.
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ export const pluginModuleFederation = (
92
92
// filter external with shared config,
93
93
const externals = config . output . externals ;
94
94
if ( Array . isArray ( externals ) ) {
95
+ const sharedModules = new Set < string > ( ) ;
95
96
config . output . externals = externals . filter ( ( ext ) => {
96
97
let sharedModule ;
97
98
if ( isRegExp ( ext ) ) {
@@ -106,11 +107,7 @@ export const pluginModuleFederation = (
106
107
return false ;
107
108
} ) ;
108
109
109
- if ( match ) {
110
- logger . log (
111
- `${ sharedModule } is removed from externals because it is a shared module.` ,
112
- ) ;
113
- }
110
+ match && sharedModule && sharedModules . add ( sharedModule ) ;
114
111
return ! match ;
115
112
}
116
113
@@ -126,15 +123,20 @@ export const pluginModuleFederation = (
126
123
return dep === ext ;
127
124
} ) ;
128
125
if ( match ) {
129
- logger . log (
130
- `${ sharedModule } is removed from externals because it is a shared module.` ,
131
- ) ;
126
+ sharedModule && sharedModules . add ( sharedModule ) ;
132
127
return false ;
133
128
}
134
129
return true ;
135
130
}
136
131
return true ;
137
132
} ) ;
133
+ if ( sharedModules . size > 0 ) {
134
+ for ( const sharedModule of sharedModules ) {
135
+ logger . log (
136
+ `${ sharedModule } is removed from externals because it is a shared module.` ,
137
+ ) ;
138
+ }
139
+ }
138
140
}
139
141
140
142
const mfConfig : EnvironmentConfig = {
You can’t perform that action at this time.
0 commit comments