@module-federation/rsbuild-plugin 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -106,6 +106,7 @@ function isStoryBook(rsbuildConfig) {
106
106
  })) {
107
107
  return true;
108
108
  }
109
+ return false;
109
110
  }
110
111
  function isMFFormat(bundlerConfig) {
111
112
  var _bundlerConfig_output;
@@ -113,8 +114,7 @@ function isMFFormat(bundlerConfig) {
113
114
  if (bundlerConfig.name === utils.SSR_ENV_NAME) {
114
115
  return true;
115
116
  }
116
- return !((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && // if the type is umd/modern-module or commonjs*, means this is a normal library , not mf
117
- (LIB_FORMAT.includes(library.type) || /commonjs/.test(library.type)));
117
+ return !((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && (LIB_FORMAT.includes(library.type) || /commonjs/.test(library.type)));
118
118
  }
119
119
  var isSSRConfig = function(bundlerConfigName) {
120
120
  return Boolean(bundlerConfigName === utils.SSR_ENV_NAME);
@@ -160,21 +160,16 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
160
160
  }, function(item) {
161
161
  return item;
162
162
  });
163
- // shared[0] is the shared name
164
163
  var shared = sharedOptions.map(function(shared) {
165
164
  return shared[0].endsWith('/') ? shared[0].slice(0, -1) : shared[0];
166
165
  });
167
166
  api.modifyRsbuildConfig(function(config) {
168
- // skip storybook
169
167
  if (isStoryBook(config)) {
170
168
  return;
171
169
  }
172
- // Change some default configs for remote modules
173
170
  if (moduleFederationOptions.exposes) {
174
171
  var _userConfig_server, _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
175
- var _config, _config1, // Allow remote modules to be loaded by setting CORS headers
176
- // This is required for MF to work properly across different origins
177
- _config_server2;
172
+ var _config, _config1, _config_server2;
178
173
  (_config = config).dev || (_config.dev = {});
179
174
  (_config1 = config).server || (_config1.server = {});
180
175
  var userConfig = api.getRsbuildConfig('original');
@@ -187,15 +182,11 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
187
182
  !isRslib && !isRspress && logger.warn(corsWarnMsgs.join('\n'));
188
183
  config.server.headers['Access-Control-Allow-Origin'] = '*';
189
184
  }
190
- // For remote modules, Rsbuild should send the ws request to the provider's dev server.
191
- // This allows the provider to do HMR when the provider module is loaded in the consumer's page.
192
185
  if (((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.port) && !((_config_dev_client = config.dev.client) === null || _config_dev_client === void 0 ? void 0 : _config_dev_client.port)) {
193
186
  var _config_dev;
194
187
  (_config_dev = config.dev).client || (_config_dev.client = {});
195
188
  config.dev.client.port = config.server.port;
196
189
  }
197
- // Change the default assetPrefix to `true` for remote modules.
198
- // This ensures that the remote module's assets can be requested by consumer apps with the correct URL.
199
190
  var originalConfig = api.getRsbuildConfig('original');
200
191
  if (((_originalConfig_dev = originalConfig.dev) === null || _originalConfig_dev === void 0 ? void 0 : _originalConfig_dev.assetPrefix) === undefined && config.dev.assetPrefix === ((_config_server1 = config.server) === null || _config_server1 === void 0 ? void 0 : _config_server1.base)) {
201
192
  config.dev.assetPrefix = true;
@@ -210,10 +201,11 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
210
201
  }
211
202
  });
212
203
  api.modifyEnvironmentConfig(function(config) {
213
- // Module Federation runtime uses ES6+ syntax,
214
- // adding to include and let SWC transform it
215
204
  config.source.include = _to_consumable_array(config.source.include || []).concat([
216
- /@module-federation[\\/]/
205
+ /@module-federation\/webpack-bundler-runtime/,
206
+ /@module-federation\/runtime/,
207
+ /@module-federation\/runtime-core/,
208
+ /@module-federation\/sdk/
217
209
  ]);
218
210
  return config;
219
211
  });
@@ -239,7 +231,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
239
231
  bundlerConfig.output.uniqueName = "".concat(moduleFederationOptions.name, "-storybook-host");
240
232
  } else {
241
233
  var _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output, _bundlerConfig_output1;
242
- // mf
243
234
  utils.autoDeleteSplitChunkCacheGroups(moduleFederationOptions, bundlerConfig === null || bundlerConfig === void 0 ? void 0 : (_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks);
244
235
  utils.addDataFetchExposes(moduleFederationOptions.exposes, isSSRConfig(bundlerConfig.name));
245
236
  (_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? true : delete _bundlerConfig_optimization1.runtimeChunk;
@@ -304,7 +295,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
304
295
  bundlerConfig.output.chunkLoading = 'jsonp';
305
296
  bundlerConfig.output.chunkLoadingGlobal = "chunk_".concat(moduleFederationOptions.name);
306
297
  }
307
- // `uniqueName` is required for react refresh to work
308
298
  if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.uniqueName)) {
309
299
  bundlerConfig.output.uniqueName = moduleFederationOptions.name;
310
300
  }
@@ -319,7 +309,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
319
309
  } else if (isRspressSSGConfig(bundlerConfig.name)) {
320
310
  var _bundlerConfig;
321
311
  var mfConfig = _object_spread_props(_object_spread({}, utils.createSSRMFConfig(moduleFederationOptions)), {
322
- // expose in mf-ssg env
323
312
  exposes: {},
324
313
  manifest: false,
325
314
  library: undefined
@@ -327,7 +316,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
327
316
  utils.patchSSRRspackConfig(bundlerConfig, mfConfig, constant.RSPRESS_SSR_DIR, callerName, false, false);
328
317
  (_bundlerConfig = bundlerConfig).output || (_bundlerConfig.output = {});
329
318
  bundlerConfig.output.publicPath = '/';
330
- // MF depend on asyncChunks
331
319
  bundlerConfig.output.asyncChunks = undefined;
332
320
  generateMergedStatsAndManifestOptions.options.rspressSSGPlugin = new rspack.ModuleFederationPlugin(mfConfig);
333
321
  bundlerConfig.plugins.push(generateMergedStatsAndManifestOptions.options.rspressSSGPlugin);
@@ -106,6 +106,7 @@ function isStoryBook(rsbuildConfig) {
106
106
  })) {
107
107
  return true;
108
108
  }
109
+ return false;
109
110
  }
110
111
  function isMFFormat(bundlerConfig) {
111
112
  var _bundlerConfig_output;
@@ -113,8 +114,7 @@ function isMFFormat(bundlerConfig) {
113
114
  if (bundlerConfig.name === SSR_ENV_NAME) {
114
115
  return true;
115
116
  }
116
- return !((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && // if the type is umd/modern-module or commonjs*, means this is a normal library , not mf
117
- (LIB_FORMAT.includes(library.type) || /commonjs/.test(library.type)));
117
+ return !((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && (LIB_FORMAT.includes(library.type) || /commonjs/.test(library.type)));
118
118
  }
119
119
  var isSSRConfig = function(bundlerConfigName) {
120
120
  return Boolean(bundlerConfigName === SSR_ENV_NAME);
@@ -160,21 +160,16 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
160
160
  }, function(item) {
161
161
  return item;
162
162
  });
163
- // shared[0] is the shared name
164
163
  var shared = sharedOptions.map(function(shared) {
165
164
  return shared[0].endsWith('/') ? shared[0].slice(0, -1) : shared[0];
166
165
  });
167
166
  api.modifyRsbuildConfig(function(config) {
168
- // skip storybook
169
167
  if (isStoryBook(config)) {
170
168
  return;
171
169
  }
172
- // Change some default configs for remote modules
173
170
  if (moduleFederationOptions.exposes) {
174
171
  var _userConfig_server, _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
175
- var _config, _config1, // Allow remote modules to be loaded by setting CORS headers
176
- // This is required for MF to work properly across different origins
177
- _config_server2;
172
+ var _config, _config1, _config_server2;
178
173
  (_config = config).dev || (_config.dev = {});
179
174
  (_config1 = config).server || (_config1.server = {});
180
175
  var userConfig = api.getRsbuildConfig('original');
@@ -187,15 +182,11 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
187
182
  !isRslib && !isRspress && logger.warn(corsWarnMsgs.join('\n'));
188
183
  config.server.headers['Access-Control-Allow-Origin'] = '*';
189
184
  }
190
- // For remote modules, Rsbuild should send the ws request to the provider's dev server.
191
- // This allows the provider to do HMR when the provider module is loaded in the consumer's page.
192
185
  if (((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.port) && !((_config_dev_client = config.dev.client) === null || _config_dev_client === void 0 ? void 0 : _config_dev_client.port)) {
193
186
  var _config_dev;
194
187
  (_config_dev = config.dev).client || (_config_dev.client = {});
195
188
  config.dev.client.port = config.server.port;
196
189
  }
197
- // Change the default assetPrefix to `true` for remote modules.
198
- // This ensures that the remote module's assets can be requested by consumer apps with the correct URL.
199
190
  var originalConfig = api.getRsbuildConfig('original');
200
191
  if (((_originalConfig_dev = originalConfig.dev) === null || _originalConfig_dev === void 0 ? void 0 : _originalConfig_dev.assetPrefix) === undefined && config.dev.assetPrefix === ((_config_server1 = config.server) === null || _config_server1 === void 0 ? void 0 : _config_server1.base)) {
201
192
  config.dev.assetPrefix = true;
@@ -210,10 +201,11 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
210
201
  }
211
202
  });
212
203
  api.modifyEnvironmentConfig(function(config) {
213
- // Module Federation runtime uses ES6+ syntax,
214
- // adding to include and let SWC transform it
215
204
  config.source.include = _to_consumable_array(config.source.include || []).concat([
216
- /@module-federation[\\/]/
205
+ /@module-federation\/webpack-bundler-runtime/,
206
+ /@module-federation\/runtime/,
207
+ /@module-federation\/runtime-core/,
208
+ /@module-federation\/sdk/
217
209
  ]);
218
210
  return config;
219
211
  });
@@ -239,7 +231,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
239
231
  bundlerConfig.output.uniqueName = "".concat(moduleFederationOptions.name, "-storybook-host");
240
232
  } else {
241
233
  var _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output, _bundlerConfig_output1;
242
- // mf
243
234
  autoDeleteSplitChunkCacheGroups(moduleFederationOptions, bundlerConfig === null || bundlerConfig === void 0 ? void 0 : (_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks);
244
235
  addDataFetchExposes(moduleFederationOptions.exposes, isSSRConfig(bundlerConfig.name));
245
236
  (_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? true : delete _bundlerConfig_optimization1.runtimeChunk;
@@ -304,7 +295,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
304
295
  bundlerConfig.output.chunkLoading = 'jsonp';
305
296
  bundlerConfig.output.chunkLoadingGlobal = "chunk_".concat(moduleFederationOptions.name);
306
297
  }
307
- // `uniqueName` is required for react refresh to work
308
298
  if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.uniqueName)) {
309
299
  bundlerConfig.output.uniqueName = moduleFederationOptions.name;
310
300
  }
@@ -319,7 +309,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
319
309
  } else if (isRspressSSGConfig(bundlerConfig.name)) {
320
310
  var _bundlerConfig;
321
311
  var mfConfig = _object_spread_props(_object_spread({}, createSSRMFConfig(moduleFederationOptions)), {
322
- // expose in mf-ssg env
323
312
  exposes: {},
324
313
  manifest: false,
325
314
  library: undefined
@@ -327,7 +316,6 @@ var pluginModuleFederation = function(moduleFederationOptions, rsbuildOptions) {
327
316
  patchSSRRspackConfig(bundlerConfig, mfConfig, RSPRESS_SSR_DIR, callerName, false, false);
328
317
  (_bundlerConfig = bundlerConfig).output || (_bundlerConfig.output = {});
329
318
  bundlerConfig.output.publicPath = '/';
330
- // MF depend on asyncChunks
331
319
  bundlerConfig.output.asyncChunks = undefined;
332
320
  generateMergedStatsAndManifestOptions.options.rspressSSGPlugin = new ModuleFederationPlugin(mfConfig);
333
321
  bundlerConfig.plugins.push(generateMergedStatsAndManifestOptions.options.rspressSSGPlugin);
@@ -24,5 +24,5 @@ export { RSBUILD_PLUGIN_MODULE_FEDERATION_NAME, PLUGIN_NAME, SSR_DIR };
24
24
  export declare function isMFFormat(bundlerConfig: Rspack.Configuration): boolean;
25
25
  declare const isSSRConfig: (bundlerConfigName?: string) => boolean;
26
26
  declare const isRspressSSGConfig: (bundlerConfigName?: string) => bundlerConfigName is "node";
27
- export declare const pluginModuleFederation: (moduleFederationOptions: ModuleFederationOptions, rsbuildOptions: RSBUILD_PLUGIN_OPTIONS) => RsbuildPlugin;
27
+ export declare const pluginModuleFederation: (moduleFederationOptions: ModuleFederationOptions, rsbuildOptions?: RSBUILD_PLUGIN_OPTIONS) => RsbuildPlugin;
28
28
  export { createModuleFederationConfig } from '@module-federation/sdk';
package/dist/utils.cjs.js CHANGED
@@ -8,14 +8,6 @@ var sdk = require('@module-federation/sdk');
8
8
  var node_module = require('node:module');
9
9
 
10
10
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
11
- // lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
12
- // lib-react.js: include react,react-dom.
13
- // lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
14
- // lib-lodash.js: include lodash,lodash-es.
15
- // lib-antd.js: include antd.
16
- // lib-arco.js: include @arco-design/web-react.
17
- // lib-semi.js: include @douyinfe/semi-ui.
18
- // lib-axios.js: include axios.
19
11
  var SPLIT_CHUNK_MAP = {
20
12
  REACT: 'react',
21
13
  ROUTER: 'router',
@@ -129,7 +121,6 @@ function mergeStats(browserStats, nodeStats) {
129
121
  var ssrRemoteEntry = nodeStats.metaData.remoteEntry;
130
122
  browserStats.metaData.ssrRemoteEntry = ssrRemoteEntry;
131
123
  if ('publicPath' in browserStats.metaData) {
132
- // @ts-ignore nodeStats has the same structure with browserStats
133
124
  browserStats.metaData.ssrPublicPath = nodeStats.metaData.publicPath;
134
125
  }
135
126
  return browserStats;
@@ -138,7 +129,6 @@ function mergeManifest(browserManifest, nodeManifest) {
138
129
  var ssrRemoteEntry = nodeManifest.metaData.remoteEntry;
139
130
  browserManifest.metaData.ssrRemoteEntry = ssrRemoteEntry;
140
131
  if ('publicPath' in browserManifest.metaData) {
141
- // @ts-ignore nodeStats has the same structure with browserStats
142
132
  browserManifest.metaData.ssrPublicPath = nodeManifest.metaData.publicPath;
143
133
  }
144
134
  return browserManifest;
@@ -245,7 +235,7 @@ function setSSREnv() {
245
235
  process.env['MF_SSR_PRJ'] = 'true';
246
236
  }
247
237
  var isDev = function() {
248
- return process.env.NODE_ENV === 'development';
238
+ return process.env['NODE_ENV'] === 'development';
249
239
  };
250
240
  function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName) {
251
241
  var resetEntry = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true, modifyPublicPath = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
@@ -265,11 +255,9 @@ function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName) {
265
255
  config.output.publicPath = publicPathWithSSRDir;
266
256
  }
267
257
  if (callerName === constant.CALL_NAME_MAP.RSPRESS && resetEntry) {
268
- // set virtue entry, only need mf entry
269
258
  config.entry = 'data:application/node;base64,';
270
259
  }
271
260
  config.target = 'async-node';
272
- // @module-federation/node/universe-entry-chunk-tracker-plugin only export cjs
273
261
  var UniverseEntryChunkTrackerPlugin = require$1('@module-federation/node/universe-entry-chunk-tracker-plugin').default;
274
262
  (_config1 = config).plugins || (_config1.plugins = []);
275
263
  isDev() && config.plugins.push(new UniverseEntryChunkTrackerPlugin());
@@ -295,8 +283,6 @@ function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerN
295
283
  }
296
284
  });
297
285
  ssrEnvConfig.output = _object_spread_props(_object_spread({}, ssrEnvConfig.output), {
298
- // https://rsbuild.rs/config/output/target#other-targets
299
- // Rsbuild not support all rspack targets, so modify to async-node in modifyRspackConfig
300
286
  target: 'node',
301
287
  distPath: _object_spread_props(_object_spread({}, (_ssrEnvConfig_output = ssrEnvConfig.output) === null || _ssrEnvConfig_output === void 0 ? void 0 : _ssrEnvConfig_output.distPath), {
302
288
  root: path.join(((_ssrEnvConfig_output1 = ssrEnvConfig.output) === null || _ssrEnvConfig_output1 === void 0 ? void 0 : (_ssrEnvConfig_output_distPath = _ssrEnvConfig_output1.distPath) === null || _ssrEnvConfig_output_distPath === void 0 ? void 0 : _ssrEnvConfig_output_distPath.root) || ((_rsbuildConfig_output = rsbuildConfig.output) === null || _rsbuildConfig_output === void 0 ? void 0 : (_rsbuildConfig_output_distPath = _rsbuildConfig_output.distPath) === null || _rsbuildConfig_output_distPath === void 0 ? void 0 : _rsbuildConfig_output_distPath.root) || '', ssrDir)
@@ -319,8 +305,7 @@ function createSSRMFConfig(mfConfig) {
319
305
  });
320
306
  ssrMFConfig.runtimePlugins.push(resolve('@module-federation/node/runtimePlugin'));
321
307
  if (isDev()) {
322
- ssrMFConfig.runtimePlugins.push(// @ts-ignore
323
- resolve('@module-federation/node/record-dynamic-remote-entry-hash-plugin'));
308
+ ssrMFConfig.runtimePlugins.push(resolve('@module-federation/node/record-dynamic-remote-entry-hash-plugin'));
324
309
  }
325
310
  return ssrMFConfig;
326
311
  }
@@ -6,14 +6,6 @@ import path from 'path';
6
6
  import { TEMP_DIR, encodeName } from '@module-federation/sdk';
7
7
  import { createRequire } from 'node:module';
8
8
 
9
- // lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
10
- // lib-react.js: include react,react-dom.
11
- // lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
12
- // lib-lodash.js: include lodash,lodash-es.
13
- // lib-antd.js: include antd.
14
- // lib-arco.js: include @arco-design/web-react.
15
- // lib-semi.js: include @douyinfe/semi-ui.
16
- // lib-axios.js: include axios.
17
9
  var SPLIT_CHUNK_MAP = {
18
10
  REACT: 'react',
19
11
  ROUTER: 'router',
@@ -127,7 +119,6 @@ function mergeStats(browserStats, nodeStats) {
127
119
  var ssrRemoteEntry = nodeStats.metaData.remoteEntry;
128
120
  browserStats.metaData.ssrRemoteEntry = ssrRemoteEntry;
129
121
  if ('publicPath' in browserStats.metaData) {
130
- // @ts-ignore nodeStats has the same structure with browserStats
131
122
  browserStats.metaData.ssrPublicPath = nodeStats.metaData.publicPath;
132
123
  }
133
124
  return browserStats;
@@ -136,7 +127,6 @@ function mergeManifest(browserManifest, nodeManifest) {
136
127
  var ssrRemoteEntry = nodeManifest.metaData.remoteEntry;
137
128
  browserManifest.metaData.ssrRemoteEntry = ssrRemoteEntry;
138
129
  if ('publicPath' in browserManifest.metaData) {
139
- // @ts-ignore nodeStats has the same structure with browserStats
140
130
  browserManifest.metaData.ssrPublicPath = nodeManifest.metaData.publicPath;
141
131
  }
142
132
  return browserManifest;
@@ -243,7 +233,7 @@ function setSSREnv() {
243
233
  process.env['MF_SSR_PRJ'] = 'true';
244
234
  }
245
235
  var isDev = function() {
246
- return process.env.NODE_ENV === 'development';
236
+ return process.env['NODE_ENV'] === 'development';
247
237
  };
248
238
  function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName) {
249
239
  var resetEntry = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true, modifyPublicPath = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
@@ -263,11 +253,9 @@ function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName) {
263
253
  config.output.publicPath = publicPathWithSSRDir;
264
254
  }
265
255
  if (callerName === CALL_NAME_MAP.RSPRESS && resetEntry) {
266
- // set virtue entry, only need mf entry
267
256
  config.entry = 'data:application/node;base64,';
268
257
  }
269
258
  config.target = 'async-node';
270
- // @module-federation/node/universe-entry-chunk-tracker-plugin only export cjs
271
259
  var UniverseEntryChunkTrackerPlugin = require('@module-federation/node/universe-entry-chunk-tracker-plugin').default;
272
260
  (_config1 = config).plugins || (_config1.plugins = []);
273
261
  isDev() && config.plugins.push(new UniverseEntryChunkTrackerPlugin());
@@ -293,8 +281,6 @@ function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerN
293
281
  }
294
282
  });
295
283
  ssrEnvConfig.output = _object_spread_props(_object_spread({}, ssrEnvConfig.output), {
296
- // https://rsbuild.rs/config/output/target#other-targets
297
- // Rsbuild not support all rspack targets, so modify to async-node in modifyRspackConfig
298
284
  target: 'node',
299
285
  distPath: _object_spread_props(_object_spread({}, (_ssrEnvConfig_output = ssrEnvConfig.output) === null || _ssrEnvConfig_output === void 0 ? void 0 : _ssrEnvConfig_output.distPath), {
300
286
  root: path.join(((_ssrEnvConfig_output1 = ssrEnvConfig.output) === null || _ssrEnvConfig_output1 === void 0 ? void 0 : (_ssrEnvConfig_output_distPath = _ssrEnvConfig_output1.distPath) === null || _ssrEnvConfig_output_distPath === void 0 ? void 0 : _ssrEnvConfig_output_distPath.root) || ((_rsbuildConfig_output = rsbuildConfig.output) === null || _rsbuildConfig_output === void 0 ? void 0 : (_rsbuildConfig_output_distPath = _rsbuildConfig_output.distPath) === null || _rsbuildConfig_output_distPath === void 0 ? void 0 : _rsbuildConfig_output_distPath.root) || '', ssrDir)
@@ -317,8 +303,7 @@ function createSSRMFConfig(mfConfig) {
317
303
  });
318
304
  ssrMFConfig.runtimePlugins.push(resolve('@module-federation/node/runtimePlugin'));
319
305
  if (isDev()) {
320
- ssrMFConfig.runtimePlugins.push(// @ts-ignore
321
- resolve('@module-federation/node/record-dynamic-remote-entry-hash-plugin'));
306
+ ssrMFConfig.runtimePlugins.push(resolve('@module-federation/node/record-dynamic-remote-entry-hash-plugin'));
322
307
  }
323
308
  return ssrMFConfig;
324
309
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/rsbuild-plugin",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Module Federation plugin for Rsbuild",
5
5
  "homepage": "https://module-federation.io",
6
6
  "bugs": {
@@ -14,33 +14,34 @@
14
14
  "license": "MIT",
15
15
  "exports": {
16
16
  ".": {
17
- "types": "./dist/index.cjs.d.ts",
17
+ "types": "./dist/index.d.ts",
18
18
  "import": "./dist/index.esm.mjs",
19
19
  "require": "./dist/index.cjs.js"
20
20
  },
21
21
  "./utils": {
22
- "types": "./dist/utils.cjs.d.ts",
22
+ "types": "./dist/utils.d.ts",
23
23
  "import": "./dist/utils.esm.mjs",
24
24
  "require": "./dist/utils.cjs.js"
25
25
  },
26
26
  "./constant": {
27
- "types": "./dist/constant.cjs.d.ts",
27
+ "types": "./dist/constant.d.ts",
28
28
  "import": "./dist/constant.esm.mjs",
29
29
  "require": "./dist/constant.cjs.js"
30
30
  }
31
31
  },
32
32
  "main": "./dist/index.cjs.js",
33
33
  "module": "./dist/index.esm.mjs",
34
+ "types": "./dist/index.cjs.d.ts",
34
35
  "typesVersions": {
35
36
  "*": {
36
37
  ".": [
37
- "./dist/index.cjs.d.ts"
38
+ "./dist/index.d.ts"
38
39
  ],
39
40
  "utils": [
40
- "./dist/utils.cjs.d.ts"
41
+ "./dist/utils.d.ts"
41
42
  ],
42
43
  "constant": [
43
- "./dist/constant.cjs.d.ts"
44
+ "./dist/constant.d.ts"
44
45
  ]
45
46
  }
46
47
  },
@@ -49,9 +50,9 @@
49
50
  ],
50
51
  "dependencies": {
51
52
  "fs-extra": "11.3.0",
52
- "@module-federation/sdk": "0.17.0",
53
- "@module-federation/enhanced": "0.17.0",
54
- "@module-federation/node": "2.7.9"
53
+ "@module-federation/sdk": "0.18.0",
54
+ "@module-federation/enhanced": "0.18.0",
55
+ "@module-federation/node": "2.7.11"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@rsbuild/core": "^1.3.21"
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
File without changes
File without changes
File without changes