@module-federation/rsbuild-plugin 2.6.0 → 2.8.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.
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
9
9
  // The require scope
10
10
  var __webpack_require__ = {};
11
11
 
12
- /************************************************************************/
13
12
  // webpack/runtime/compat_get_default_export
14
13
  (() => {
15
14
  // getDefaultExport function for compatibility with non-ESM modules
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
24
23
  })();
25
24
  // webpack/runtime/define_property_getters
26
25
  (() => {
27
- __webpack_require__.d = (exports, definition) => {
28
- for(var key in definition) {
29
- if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
30
- Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
31
- }
32
- }
26
+ __webpack_require__.d = (exports, getters, values) => {
27
+ var define = (defs, kind) => {
28
+ for(var key in defs) {
29
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
31
+ }
32
+ }
33
+ };
34
+ define(getters, "get");
35
+ define(values, "value");
33
36
  };
34
37
  })();
35
38
  // webpack/runtime/has_own_property
@@ -46,7 +49,6 @@ __webpack_require__.r = (exports) => {
46
49
  Object.defineProperty(exports, '__esModule', { value: true });
47
50
  };
48
51
  })();
49
- /************************************************************************/
50
52
  var __webpack_exports__ = {};
51
53
  // ESM COMPAT FLAG
52
54
  __webpack_require__.r(__webpack_exports__);
@@ -120,9 +122,9 @@ function addDataFetchExposes(exposes, isServer) {
120
122
  }
121
123
 
122
124
  exports.addDataFetchExposes = __webpack_exports__.addDataFetchExposes;
123
- for(var __webpack_i__ in __webpack_exports__) {
124
- if(["addDataFetchExposes"].indexOf(__webpack_i__) === -1) {
125
- exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
125
+ for(var __rspack_i in __webpack_exports__) {
126
+ if(["addDataFetchExposes"].indexOf(__rspack_i) === -1) {
127
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
126
128
  }
127
129
  }
128
130
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -3,15 +3,10 @@ import path from "path";
3
3
  import { TEMP_DIR } from "@module-federation/sdk";
4
4
  import { DATA_FETCH_CLIENT_SUFFIX, DATA_FETCH_IDENTIFIER } from "../constant.mjs";
5
5
 
6
- ;// CONCATENATED MODULE: external "fs"
7
6
 
8
- ;// CONCATENATED MODULE: external "path"
9
7
 
10
- ;// CONCATENATED MODULE: external "@module-federation/sdk"
11
8
 
12
- ;// CONCATENATED MODULE: external "../constant.mjs"
13
9
 
14
- ;// CONCATENATED MODULE: ./src/utils/addDataFetchExposes.ts
15
10
 
16
11
 
17
12
 
@@ -9,15 +9,18 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
9
9
  // The require scope
10
10
  var __webpack_require__ = {};
11
11
 
12
- /************************************************************************/
13
12
  // webpack/runtime/define_property_getters
14
13
  (() => {
15
- __webpack_require__.d = (exports, definition) => {
16
- for(var key in definition) {
17
- if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
- Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
19
- }
20
- }
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
21
24
  };
22
25
  })();
23
26
  // webpack/runtime/has_own_property
@@ -34,12 +37,8 @@ __webpack_require__.r = (exports) => {
34
37
  Object.defineProperty(exports, '__esModule', { value: true });
35
38
  };
36
39
  })();
37
- /************************************************************************/
38
40
  var __webpack_exports__ = {};
39
41
  __webpack_require__.r(__webpack_exports__);
40
- __webpack_require__.d(__webpack_exports__, {
41
- autoDeleteSplitChunkCacheGroups: () => (autoDeleteSplitChunkCacheGroups)
42
- });
43
42
  // lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
44
43
  // lib-react.js: include react,react-dom.
45
44
  // lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
@@ -74,7 +73,7 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
74
73
  if (!mfConfig.shared) {
75
74
  return;
76
75
  }
77
- if (!splitChunks || !(splitChunks === null || splitChunks === void 0 ? void 0 : splitChunks.cacheGroups)) {
76
+ if (!splitChunks || !splitChunks?.cacheGroups) {
78
77
  return;
79
78
  }
80
79
  const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
@@ -90,10 +89,14 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
90
89
  return splitChunks;
91
90
  }
92
91
 
92
+ __webpack_require__.d(__webpack_exports__, {
93
+ autoDeleteSplitChunkCacheGroups: () => (autoDeleteSplitChunkCacheGroups)
94
+ });
95
+
93
96
  exports.autoDeleteSplitChunkCacheGroups = __webpack_exports__.autoDeleteSplitChunkCacheGroups;
94
- for(var __webpack_i__ in __webpack_exports__) {
95
- if(["autoDeleteSplitChunkCacheGroups"].indexOf(__webpack_i__) === -1) {
96
- exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
97
+ for(var __rspack_i in __webpack_exports__) {
98
+ if(["autoDeleteSplitChunkCacheGroups"].indexOf(__rspack_i) === -1) {
99
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
97
100
  }
98
101
  }
99
102
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,5 +1,3 @@
1
-
2
- ;// CONCATENATED MODULE: ./src/utils/autoDeleteSplitChunkCacheGroups.ts
3
1
  // lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
4
2
  // lib-react.js: include react,react-dom.
5
3
  // lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
@@ -34,7 +32,7 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
34
32
  if (!mfConfig.shared) {
35
33
  return;
36
34
  }
37
- if (!splitChunks || !(splitChunks === null || splitChunks === void 0 ? void 0 : splitChunks.cacheGroups)) {
35
+ if (!splitChunks || !splitChunks?.cacheGroups) {
38
36
  return;
39
37
  }
40
38
  const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
9
9
  // The require scope
10
10
  var __webpack_require__ = {};
11
11
 
12
- /************************************************************************/
13
12
  // webpack/runtime/compat_get_default_export
14
13
  (() => {
15
14
  // getDefaultExport function for compatibility with non-ESM modules
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
24
23
  })();
25
24
  // webpack/runtime/define_property_getters
26
25
  (() => {
27
- __webpack_require__.d = (exports, definition) => {
28
- for(var key in definition) {
29
- if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
30
- Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
31
- }
32
- }
26
+ __webpack_require__.d = (exports, getters, values) => {
27
+ var define = (defs, kind) => {
28
+ for(var key in defs) {
29
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
31
+ }
32
+ }
33
+ };
34
+ define(getters, "get");
35
+ define(values, "value");
33
36
  };
34
37
  })();
35
38
  // webpack/runtime/has_own_property
@@ -46,24 +49,23 @@ __webpack_require__.r = (exports) => {
46
49
  Object.defineProperty(exports, '__esModule', { value: true });
47
50
  };
48
51
  })();
49
- /************************************************************************/
50
52
  var __webpack_exports__ = {};
51
53
  // ESM COMPAT FLAG
52
54
  __webpack_require__.r(__webpack_exports__);
53
55
 
54
56
  // EXPORTS
55
57
  __webpack_require__.d(__webpack_exports__, {
56
- createSSRREnvConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRREnvConfig),
57
58
  DEFAULT_ASSET_PREFIX: () => (/* reexport */ external_constant_js_namespaceObject.DEFAULT_ASSET_PREFIX),
59
+ SSR_DIR: () => (/* reexport */ external_ssr_js_namespaceObject.SSR_DIR),
58
60
  SSR_ENV_NAME: () => (/* reexport */ external_ssr_js_namespaceObject.SSR_ENV_NAME),
61
+ addDataFetchExposes: () => (/* reexport */ external_addDataFetchExposes_js_namespaceObject.addDataFetchExposes),
59
62
  autoDeleteSplitChunkCacheGroups: () => (/* reexport */ external_autoDeleteSplitChunkCacheGroups_js_namespaceObject.autoDeleteSplitChunkCacheGroups),
60
- setSSREnv: () => (/* reexport */ external_ssr_js_namespaceObject.setSSREnv),
61
- updateStatsAndManifest: () => (/* reexport */ external_manifest_js_namespaceObject.updateStatsAndManifest),
63
+ createSSRMFConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRMFConfig),
64
+ createSSRREnvConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRREnvConfig),
62
65
  isRegExp: () => (/* binding */ isRegExp),
63
66
  patchSSRRspackConfig: () => (/* reexport */ external_ssr_js_namespaceObject.patchSSRRspackConfig),
64
- SSR_DIR: () => (/* reexport */ external_ssr_js_namespaceObject.SSR_DIR),
65
- createSSRMFConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRMFConfig),
66
- addDataFetchExposes: () => (/* reexport */ external_addDataFetchExposes_js_namespaceObject.addDataFetchExposes)
67
+ setSSREnv: () => (/* reexport */ external_ssr_js_namespaceObject.setSSREnv),
68
+ updateStatsAndManifest: () => (/* reexport */ external_manifest_js_namespaceObject.updateStatsAndManifest)
67
69
  });
68
70
 
69
71
  ;// CONCATENATED MODULE: external "util"
@@ -101,9 +103,9 @@ exports.isRegExp = __webpack_exports__.isRegExp;
101
103
  exports.patchSSRRspackConfig = __webpack_exports__.patchSSRRspackConfig;
102
104
  exports.setSSREnv = __webpack_exports__.setSSREnv;
103
105
  exports.updateStatsAndManifest = __webpack_exports__.updateStatsAndManifest;
104
- for(var __webpack_i__ in __webpack_exports__) {
105
- if(["DEFAULT_ASSET_PREFIX","SSR_DIR","SSR_ENV_NAME","addDataFetchExposes","autoDeleteSplitChunkCacheGroups","createSSRMFConfig","createSSRREnvConfig","isRegExp","patchSSRRspackConfig","setSSREnv","updateStatsAndManifest"].indexOf(__webpack_i__) === -1) {
106
- exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
106
+ for(var __rspack_i in __webpack_exports__) {
107
+ if(["DEFAULT_ASSET_PREFIX","SSR_DIR","SSR_ENV_NAME","addDataFetchExposes","autoDeleteSplitChunkCacheGroups","createSSRMFConfig","createSSRREnvConfig","isRegExp","patchSSRRspackConfig","setSSREnv","updateStatsAndManifest"].indexOf(__rspack_i) === -1) {
108
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
107
109
  }
108
110
  }
109
111
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,23 +1,11 @@
1
1
  import util from "util";
2
- import { DEFAULT_ASSET_PREFIX } from "../constant.mjs";
3
- import { autoDeleteSplitChunkCacheGroups } from "./autoDeleteSplitChunkCacheGroups.mjs";
4
- import { addDataFetchExposes } from "./addDataFetchExposes.mjs";
5
- import { updateStatsAndManifest } from "./manifest.mjs";
6
- import { SSR_DIR, SSR_ENV_NAME, createSSRMFConfig, createSSRREnvConfig, patchSSRRspackConfig, setSSREnv } from "./ssr.mjs";
7
2
 
8
- ;// CONCATENATED MODULE: external "util"
9
3
 
10
- ;// CONCATENATED MODULE: external "../constant.mjs"
11
4
 
12
- ;// CONCATENATED MODULE: external "./autoDeleteSplitChunkCacheGroups.mjs"
13
5
 
14
- ;// CONCATENATED MODULE: external "./addDataFetchExposes.mjs"
15
6
 
16
- ;// CONCATENATED MODULE: external "./manifest.mjs"
17
7
 
18
- ;// CONCATENATED MODULE: external "./ssr.mjs"
19
8
 
20
- ;// CONCATENATED MODULE: ./src/utils/index.ts
21
9
 
22
10
  function isRegExp(target) {
23
11
  return util.types.isRegExp(target);
@@ -28,4 +16,9 @@ function isRegExp(target) {
28
16
 
29
17
 
30
18
 
31
- export { DEFAULT_ASSET_PREFIX, SSR_DIR, SSR_ENV_NAME, addDataFetchExposes, autoDeleteSplitChunkCacheGroups, createSSRMFConfig, createSSRREnvConfig, isRegExp, patchSSRRspackConfig, setSSREnv, updateStatsAndManifest };
19
+ export { isRegExp };
20
+ export { DEFAULT_ASSET_PREFIX } from "../constant.mjs";
21
+ export { autoDeleteSplitChunkCacheGroups } from "./autoDeleteSplitChunkCacheGroups.mjs";
22
+ export { addDataFetchExposes } from "./addDataFetchExposes.mjs";
23
+ export { updateStatsAndManifest } from "./manifest.mjs";
24
+ export { SSR_DIR, SSR_ENV_NAME, createSSRMFConfig, createSSRREnvConfig, patchSSRRspackConfig, setSSREnv } from "./ssr.mjs";
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
9
9
  // The require scope
10
10
  var __webpack_require__ = {};
11
11
 
12
- /************************************************************************/
13
12
  // webpack/runtime/compat_get_default_export
14
13
  (() => {
15
14
  // getDefaultExport function for compatibility with non-ESM modules
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
24
23
  })();
25
24
  // webpack/runtime/define_property_getters
26
25
  (() => {
27
- __webpack_require__.d = (exports, definition) => {
28
- for(var key in definition) {
29
- if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
30
- Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
31
- }
32
- }
26
+ __webpack_require__.d = (exports, getters, values) => {
27
+ var define = (defs, kind) => {
28
+ for(var key in defs) {
29
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
31
+ }
32
+ }
33
+ };
34
+ define(getters, "get");
35
+ define(values, "value");
33
36
  };
34
37
  })();
35
38
  // webpack/runtime/has_own_property
@@ -46,7 +49,6 @@ __webpack_require__.r = (exports) => {
46
49
  Object.defineProperty(exports, '__esModule', { value: true });
47
50
  };
48
51
  })();
49
- /************************************************************************/
50
52
  var __webpack_exports__ = {};
51
53
  // ESM COMPAT FLAG
52
54
  __webpack_require__.r(__webpack_exports__);
@@ -105,9 +107,9 @@ function updateStatsAndManifest(nodeAssets, browserAssets, outputDir) {
105
107
  }
106
108
 
107
109
  exports.updateStatsAndManifest = __webpack_exports__.updateStatsAndManifest;
108
- for(var __webpack_i__ in __webpack_exports__) {
109
- if(["updateStatsAndManifest"].indexOf(__webpack_i__) === -1) {
110
- exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
110
+ for(var __rspack_i in __webpack_exports__) {
111
+ if(["updateStatsAndManifest"].indexOf(__rspack_i) === -1) {
112
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
111
113
  }
112
114
  }
113
115
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,11 +1,8 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
 
4
- ;// CONCATENATED MODULE: external "path"
5
4
 
6
- ;// CONCATENATED MODULE: external "fs"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/utils/manifest.ts
9
6
 
10
7
 
11
8
  function mergeStats(browserStats, nodeStats) {
@@ -35,7 +35,9 @@ export declare function createSSRMFConfig(mfConfig: moduleFederationPlugin.Modul
35
35
  asyncStartup?: boolean;
36
36
  optimization?: {
37
37
  disableSnapshot?: boolean;
38
- target?: "web" | "node";
38
+ disableRemote?: boolean;
39
+ disableShared?: boolean;
40
+ target?: 'web' | 'node';
39
41
  };
40
42
  };
41
43
  bridge?: {
package/dist/utils/ssr.js CHANGED
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
9
9
  // The require scope
10
10
  var __webpack_require__ = {};
11
11
 
12
- /************************************************************************/
13
12
  // webpack/runtime/compat_get_default_export
14
13
  (() => {
15
14
  // getDefaultExport function for compatibility with non-ESM modules
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
24
23
  })();
25
24
  // webpack/runtime/define_property_getters
26
25
  (() => {
27
- __webpack_require__.d = (exports, definition) => {
28
- for(var key in definition) {
29
- if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
30
- Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
31
- }
32
- }
26
+ __webpack_require__.d = (exports, getters, values) => {
27
+ var define = (defs, kind) => {
28
+ for(var key in defs) {
29
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
31
+ }
32
+ }
33
+ };
34
+ define(getters, "get");
35
+ define(values, "value");
33
36
  };
34
37
  })();
35
38
  // webpack/runtime/has_own_property
@@ -46,23 +49,22 @@ __webpack_require__.r = (exports) => {
46
49
  Object.defineProperty(exports, '__esModule', { value: true });
47
50
  };
48
51
  })();
49
- /************************************************************************/
50
52
  var __webpack_exports__ = {};
51
53
  // ESM COMPAT FLAG
52
54
  __webpack_require__.r(__webpack_exports__);
53
55
 
54
56
  // EXPORTS
55
57
  __webpack_require__.d(__webpack_exports__, {
56
- patchNodeConfig: () => (/* binding */ patchNodeConfig),
58
+ ENV_NAME: () => (/* binding */ ENV_NAME),
59
+ SSR_DIR: () => (/* binding */ SSR_DIR),
60
+ SSR_ENV_NAME: () => (/* binding */ SSR_ENV_NAME),
61
+ createSSRMFConfig: () => (/* binding */ createSSRMFConfig),
57
62
  createSSRREnvConfig: () => (/* binding */ createSSRREnvConfig),
58
- setSSREnv: () => (/* binding */ setSSREnv),
63
+ patchNodeConfig: () => (/* binding */ patchNodeConfig),
59
64
  patchNodeMFConfig: () => (/* binding */ patchNodeMFConfig),
60
- SSR_ENV_NAME: () => (/* binding */ SSR_ENV_NAME),
61
- patchToolsTspack: () => (/* binding */ patchToolsTspack),
62
65
  patchSSRRspackConfig: () => (/* binding */ patchSSRRspackConfig),
63
- SSR_DIR: () => (/* binding */ SSR_DIR),
64
- ENV_NAME: () => (/* binding */ ENV_NAME),
65
- createSSRMFConfig: () => (/* binding */ createSSRMFConfig)
66
+ patchToolsTspack: () => (/* binding */ patchToolsTspack),
67
+ setSSREnv: () => (/* binding */ setSSREnv)
66
68
  });
67
69
 
68
70
  ;// CONCATENATED MODULE: external "path"
@@ -105,7 +107,6 @@ const isDev = ()=>{
105
107
  return process.env['NODE_ENV'] === 'development';
106
108
  };
107
109
  function patchNodeConfig(config, mfConfig) {
108
- var _config_output;
109
110
  config.output ||= {};
110
111
  if (config.output.publicPath === 'auto') {
111
112
  config.output.publicPath = '';
@@ -116,14 +117,30 @@ function patchNodeConfig(config, mfConfig) {
116
117
  config.output.module = false;
117
118
  config.output.chunkFormat = 'commonjs';
118
119
  config.output.chunkLoading = 'async-node';
120
+ const prevLibrary = config.output.library;
121
+ if (prevLibrary && typeof prevLibrary === 'object' && !Array.isArray(prevLibrary)) {
122
+ config.output.library = {
123
+ ...prevLibrary,
124
+ type: 'commonjs-module'
125
+ };
126
+ } else if (typeof prevLibrary === 'string' || Array.isArray(prevLibrary)) {
127
+ config.output.library = {
128
+ name: prevLibrary,
129
+ type: 'commonjs-module'
130
+ };
131
+ } else {
132
+ config.output.library = {
133
+ type: 'commonjs-module'
134
+ };
135
+ }
119
136
  delete config.output.chunkLoadingGlobal;
120
137
  const UniverseEntryChunkTrackerPluginModule = safeRequire('@module-federation/node/universe-entry-chunk-tracker-plugin');
121
- const UniverseEntryChunkTrackerPlugin = UniverseEntryChunkTrackerPluginModule === null || UniverseEntryChunkTrackerPluginModule === void 0 ? void 0 : UniverseEntryChunkTrackerPluginModule.default;
138
+ const UniverseEntryChunkTrackerPlugin = UniverseEntryChunkTrackerPluginModule?.default;
122
139
  config.plugins ||= [];
123
140
  if (isDev() && UniverseEntryChunkTrackerPlugin) {
124
141
  config.plugins.push(new UniverseEntryChunkTrackerPlugin());
125
142
  }
126
- const uniqueName = mfConfig.name || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.uniqueName);
143
+ const uniqueName = mfConfig.name || config.output?.uniqueName;
127
144
  const chunkFileName = config.output.chunkFilename;
128
145
  if (typeof chunkFileName === 'string' && uniqueName && !chunkFileName.includes(uniqueName)) {
129
146
  const encodedName = (0,sdk_namespaceObject.encodeName)(uniqueName);
@@ -133,8 +150,7 @@ function patchNodeConfig(config, mfConfig) {
133
150
  function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName, resetEntry = true, modifyPublicPath = true) {
134
151
  config.output ||= {};
135
152
  if (modifyPublicPath) {
136
- var _config_output;
137
- if (typeof ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.publicPath) !== 'string') {
153
+ if (typeof config.output?.publicPath !== 'string') {
138
154
  throw new Error('publicPath must be string!');
139
155
  }
140
156
  const publicPath = config.output.publicPath;
@@ -151,16 +167,12 @@ function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName, resetEntry =
151
167
  return config;
152
168
  }
153
169
  function patchToolsTspack(envConfig, fn) {
154
- var _envConfig_tools;
155
170
  const rspackArr = [];
156
- if ((_envConfig_tools = envConfig.tools) === null || _envConfig_tools === void 0 ? void 0 : _envConfig_tools.rspack) {
157
- var _envConfig_tools1, _envConfig_tools2;
158
- if (Array.isArray((_envConfig_tools1 = envConfig.tools) === null || _envConfig_tools1 === void 0 ? void 0 : _envConfig_tools1.rspack)) {
159
- var _envConfig_tools3;
160
- rspackArr.push(...(_envConfig_tools3 = envConfig.tools) === null || _envConfig_tools3 === void 0 ? void 0 : _envConfig_tools3.rspack);
161
- } else if (typeof ((_envConfig_tools2 = envConfig.tools) === null || _envConfig_tools2 === void 0 ? void 0 : _envConfig_tools2.rspack) === 'function') {
162
- var _envConfig_tools4;
163
- rspackArr.push((_envConfig_tools4 = envConfig.tools) === null || _envConfig_tools4 === void 0 ? void 0 : _envConfig_tools4.rspack);
171
+ if (envConfig.tools?.rspack) {
172
+ if (Array.isArray(envConfig.tools?.rspack)) {
173
+ rspackArr.push(...envConfig.tools?.rspack);
174
+ } else if (typeof envConfig.tools?.rspack === 'function') {
175
+ rspackArr.push(envConfig.tools?.rspack);
164
176
  }
165
177
  }
166
178
  envConfig.tools ||= {};
@@ -170,16 +182,12 @@ function patchToolsTspack(envConfig, fn) {
170
182
  ];
171
183
  }
172
184
  function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerName) {
173
- var _envConfig_tools, _ssrEnvConfig_output, _ssrEnvConfig_output_distPath, _ssrEnvConfig_output1, _rsbuildConfig_output_distPath, _rsbuildConfig_output;
174
185
  const rspackArr = [];
175
- if ((_envConfig_tools = envConfig.tools) === null || _envConfig_tools === void 0 ? void 0 : _envConfig_tools.rspack) {
176
- var _envConfig_tools1, _envConfig_tools2;
177
- if (Array.isArray((_envConfig_tools1 = envConfig.tools) === null || _envConfig_tools1 === void 0 ? void 0 : _envConfig_tools1.rspack)) {
178
- var _envConfig_tools3;
179
- rspackArr.push(...(_envConfig_tools3 = envConfig.tools) === null || _envConfig_tools3 === void 0 ? void 0 : _envConfig_tools3.rspack);
180
- } else if (typeof ((_envConfig_tools2 = envConfig.tools) === null || _envConfig_tools2 === void 0 ? void 0 : _envConfig_tools2.rspack) === 'function') {
181
- var _envConfig_tools4;
182
- rspackArr.push((_envConfig_tools4 = envConfig.tools) === null || _envConfig_tools4 === void 0 ? void 0 : _envConfig_tools4.rspack);
186
+ if (envConfig.tools?.rspack) {
187
+ if (Array.isArray(envConfig.tools?.rspack)) {
188
+ rspackArr.push(...envConfig.tools?.rspack);
189
+ } else if (typeof envConfig.tools?.rspack === 'function') {
190
+ rspackArr.push(envConfig.tools?.rspack);
183
191
  }
184
192
  }
185
193
  const ssrEnvConfig = {
@@ -197,15 +205,14 @@ function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerN
197
205
  // Rsbuild not support all rspack targets, so modify to async-node in modifyRspackConfig
198
206
  target: 'node',
199
207
  distPath: {
200
- ...(_ssrEnvConfig_output = ssrEnvConfig.output) === null || _ssrEnvConfig_output === void 0 ? void 0 : _ssrEnvConfig_output.distPath,
201
- root: external_path_default().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)
208
+ ...ssrEnvConfig.output?.distPath,
209
+ root: external_path_default().join(ssrEnvConfig.output?.distPath?.root || rsbuildConfig.output?.distPath?.root || '', ssrDir)
202
210
  },
203
211
  emitAssets: true
204
212
  };
205
213
  return ssrEnvConfig;
206
214
  }
207
215
  function patchNodeMFConfig(mfConfig) {
208
- var _mfConfig_library;
209
216
  if (mfConfig.remotes) {
210
217
  mfConfig.remoteType = 'script';
211
218
  }
@@ -215,7 +222,7 @@ function patchNodeMFConfig(mfConfig) {
215
222
  mfConfig.library = {
216
223
  ...mfConfig.library,
217
224
  name: mfConfig.name,
218
- type: ((_mfConfig_library = mfConfig.library) === null || _mfConfig_library === void 0 ? void 0 : _mfConfig_library.type) ?? 'commonjs-module'
225
+ type: mfConfig.library?.type ?? 'commonjs-module'
219
226
  };
220
227
  mfConfig.runtimePlugins = [
221
228
  ...mfConfig.runtimePlugins || []
@@ -245,9 +252,9 @@ exports.patchNodeMFConfig = __webpack_exports__.patchNodeMFConfig;
245
252
  exports.patchSSRRspackConfig = __webpack_exports__.patchSSRRspackConfig;
246
253
  exports.patchToolsTspack = __webpack_exports__.patchToolsTspack;
247
254
  exports.setSSREnv = __webpack_exports__.setSSREnv;
248
- for(var __webpack_i__ in __webpack_exports__) {
249
- if(["ENV_NAME","SSR_DIR","SSR_ENV_NAME","createSSRMFConfig","createSSRREnvConfig","patchNodeConfig","patchNodeMFConfig","patchSSRRspackConfig","patchToolsTspack","setSSREnv"].indexOf(__webpack_i__) === -1) {
250
- exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
255
+ for(var __rspack_i in __webpack_exports__) {
256
+ if(["ENV_NAME","SSR_DIR","SSR_ENV_NAME","createSSRMFConfig","createSSRREnvConfig","patchNodeConfig","patchNodeMFConfig","patchSSRRspackConfig","patchToolsTspack","setSSREnv"].indexOf(__rspack_i) === -1) {
257
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
251
258
  }
252
259
  }
253
260
  Object.defineProperty(exports, '__esModule', { value: true });