@@ -6,11 +6,11 @@ import { join, resolve } from 'path';
6
6
import { UnpluginOptions } from 'unplugin' ;
7
7
import { describe , expect , it , vi } from 'vitest' ;
8
8
9
+ import type { Compiler } from 'webpack' ;
9
10
import {
10
11
NativeFederationTypeScriptHost ,
11
12
NativeFederationTypeScriptRemote ,
12
13
} from './index' ;
13
- import type { Compiler } from 'webpack' ;
14
14
15
15
describe ( 'index' , ( ) => {
16
16
const projectRoot = join ( __dirname , '..' , '..' , '..' ) ;
@@ -125,6 +125,49 @@ describe('index', () => {
125
125
} ,
126
126
} ) ;
127
127
} ) ;
128
+
129
+ it ( 'correctly enrich rspack config' , async ( ) => {
130
+ const options = {
131
+ moduleFederationConfig : {
132
+ name : 'moduleFederationTypescript' ,
133
+ filename : 'remoteEntry.js' ,
134
+ exposes : {
135
+ './index' : join ( __dirname , './index.ts' ) ,
136
+ } ,
137
+ shared : {
138
+ react : { singleton : true , eager : true } ,
139
+ 'react-dom' : { singleton : true , eager : true } ,
140
+ } ,
141
+ } ,
142
+ deleteTestsFolder : false ,
143
+ testsFolder : '@mf-tests' ,
144
+ } ;
145
+
146
+ const rspackCompiler = {
147
+ options : {
148
+ devServer : {
149
+ foo : { } ,
150
+ } ,
151
+ } ,
152
+ } as any ;
153
+
154
+ const unplugin = NativeFederationTypeScriptRemote . rollup (
155
+ options ,
156
+ ) as UnpluginOptions ;
157
+
158
+ unplugin . rspack ?.( rspackCompiler ) ;
159
+
160
+ expect ( rspackCompiler ) . toStrictEqual ( {
161
+ options : {
162
+ devServer : {
163
+ foo : { } ,
164
+ static : {
165
+ directory : resolve ( './dist' ) ,
166
+ } ,
167
+ } ,
168
+ } ,
169
+ } ) ;
170
+ } ) ;
128
171
} ) ;
129
172
130
173
describe ( 'NativeFederationTypeScriptHost' , ( ) => {
0 commit comments