@module-federation/rsbuild-plugin 2.1.0 → 2.2.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/cli/index.js CHANGED
@@ -222,7 +222,11 @@ const pluginModuleFederation = (moduleFederationOptions, rsbuildOptions)=>({
222
222
  if ((_config_environments = config.environments) === null || _config_environments === void 0 ? void 0 : _config_environments[external_utils_js_namespaceObject.SSR_ENV_NAME]) {
223
223
  throw new Error(`'${external_utils_js_namespaceObject.SSR_ENV_NAME}' environment is already defined.Please use another name.`);
224
224
  }
225
- config.environments[external_utils_js_namespaceObject.SSR_ENV_NAME] = (0,external_utils_js_namespaceObject.createSSRREnvConfig)((_config_environments1 = config.environments) === null || _config_environments1 === void 0 ? void 0 : _config_environments1[environment], moduleFederationOptions, ssrDir, config, callerName);
225
+ const currentEnvironment = (_config_environments1 = config.environments) === null || _config_environments1 === void 0 ? void 0 : _config_environments1[environment];
226
+ if (!currentEnvironment) {
227
+ throw new Error(`Can not find environment '${environment}' when enabling SSR.`);
228
+ }
229
+ config.environments[external_utils_js_namespaceObject.SSR_ENV_NAME] = (0,external_utils_js_namespaceObject.createSSRREnvConfig)(currentEnvironment, moduleFederationOptions, ssrDir, config, callerName);
226
230
  const ssgMDEnv = config.environments[external_constant_js_namespaceObject.RSPRESS_SSG_MD_ENV_NAME];
227
231
  if (isRspress && ssgMDEnv) {
228
232
  (0,ssr_js_namespaceObject.patchToolsTspack)(ssgMDEnv, (config, { environment })=>{
@@ -165,7 +165,11 @@ const pluginModuleFederation = (moduleFederationOptions, rsbuildOptions)=>({
165
165
  if ((_config_environments = config.environments) === null || _config_environments === void 0 ? void 0 : _config_environments[SSR_ENV_NAME]) {
166
166
  throw new Error(`'${SSR_ENV_NAME}' environment is already defined.Please use another name.`);
167
167
  }
168
- config.environments[SSR_ENV_NAME] = createSSRREnvConfig((_config_environments1 = config.environments) === null || _config_environments1 === void 0 ? void 0 : _config_environments1[environment], moduleFederationOptions, ssrDir, config, callerName);
168
+ const currentEnvironment = (_config_environments1 = config.environments) === null || _config_environments1 === void 0 ? void 0 : _config_environments1[environment];
169
+ if (!currentEnvironment) {
170
+ throw new Error(`Can not find environment '${environment}' when enabling SSR.`);
171
+ }
172
+ config.environments[SSR_ENV_NAME] = createSSRREnvConfig(currentEnvironment, moduleFederationOptions, ssrDir, config, callerName);
169
173
  const ssgMDEnv = config.environments[RSPRESS_SSG_MD_ENV_NAME];
170
174
  if (isRspress && ssgMDEnv) {
171
175
  patchToolsTspack(ssgMDEnv, (config, { environment })=>{
@@ -28,7 +28,6 @@ export declare function createSSRMFConfig(mfConfig: moduleFederationPlugin.Modul
28
28
  manifest?: boolean | moduleFederationPlugin.PluginManifestOptions;
29
29
  dev?: boolean | moduleFederationPlugin.PluginDevOptions;
30
30
  dts?: boolean | moduleFederationPlugin.PluginDtsOptions;
31
- dataPrefetch?: moduleFederationPlugin.DataPrefetch;
32
31
  virtualRuntimeEntry?: boolean;
33
32
  experiments?: {
34
33
  externalRuntime?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/rsbuild-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Module Federation plugin for Rsbuild",
5
5
  "homepage": "https://module-federation.io",
6
6
  "bugs": {
@@ -50,9 +50,9 @@
50
50
  ],
51
51
  "dependencies": {
52
52
  "fs-extra": "11.3.0",
53
- "@module-federation/sdk": "2.1.0",
54
- "@module-federation/enhanced": "2.1.0",
55
- "@module-federation/node": "2.7.33"
53
+ "@module-federation/enhanced": "2.2.0",
54
+ "@module-federation/node": "2.7.34",
55
+ "@module-federation/sdk": "2.2.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@rslib/core": "^0.12.4",
@@ -72,5 +72,11 @@
72
72
  "publishConfig": {
73
73
  "access": "public",
74
74
  "registry": "https://registry.npmjs.org/"
75
+ },
76
+ "scripts": {
77
+ "build": "rslib build",
78
+ "lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
79
+ "test": "pnpm exec vitest run --passWithNoTests --config vite.config.mts",
80
+ "pre-release": "pnpm run test && pnpm run build"
75
81
  }
76
82
  }