@module-federation/modern-js 0.3.1 → 0.3.3

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.
@@ -43,23 +43,15 @@ function setEnv(enableSSR) {
43
43
  }
44
44
  }
45
45
  function modifyBundlerConfig(options) {
46
- const { mfConfig, config, isServer, modernjsConfig, bundlerType, remoteIpStrategy = "ipv4" } = options;
46
+ const { mfConfig, config, isServer, modernjsConfig, remoteIpStrategy = "ipv4", bundlerType } = options;
47
47
  (0, import_utils.patchMFConfig)(mfConfig, isServer, remoteIpStrategy);
48
48
  (0, import_utils.patchBundlerConfig)({
49
+ bundlerType,
49
50
  bundlerConfig: config,
50
51
  isServer,
51
52
  modernjsConfig,
52
53
  mfConfig
53
54
  });
54
- if (bundlerType === "webpack") {
55
- config.ignoreWarnings = config.ignoreWarnings || [];
56
- config.ignoreWarnings.push((warning) => {
57
- if (warning.message.includes("external script")) {
58
- return true;
59
- }
60
- return false;
61
- });
62
- }
63
55
  }
64
56
  const moduleFederationConfigPlugin = (userConfig) => ({
65
57
  name: "@modern-js/plugin-module-federation-config",
@@ -75,9 +67,17 @@ const moduleFederationConfigPlugin = (userConfig) => ({
75
67
  userConfig.csrConfig = csrConfig;
76
68
  return {
77
69
  config: async () => {
78
- var _modernjsConfig_dev;
70
+ var _modernjsConfig_server, _modernjsConfig_dev;
79
71
  const bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
80
72
  const ipv4 = (0, import_utils.getIPV4)();
73
+ const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
74
+ if (userConfig.remoteIpStrategy === void 0) {
75
+ if (!enableSSR) {
76
+ userConfig.remoteIpStrategy = "inherit";
77
+ } else {
78
+ userConfig.remoteIpStrategy = "ipv4";
79
+ }
80
+ }
81
81
  return {
82
82
  tools: {
83
83
  rspack(config, { isServer }) {
@@ -117,7 +117,8 @@ const moduleFederationConfigPlugin = (userConfig) => ({
117
117
  "@modern-js/runtime/mf": require.resolve("@module-federation/modern-js/runtime")
118
118
  },
119
119
  define: {
120
- FEDERATION_IPV4: JSON.stringify(ipv4)
120
+ FEDERATION_IPV4: JSON.stringify(ipv4),
121
+ REMOTE_IP_STRATEGY: JSON.stringify(userConfig.remoteIpStrategy)
121
122
  }
122
123
  },
123
124
  dev: {
@@ -23,7 +23,11 @@ __export(resolve_entry_ipv4_exports, {
23
23
  module.exports = __toCommonJS(resolve_entry_ipv4_exports);
24
24
  var import_constant = require("../../constant");
25
25
  const ipv4 = typeof FEDERATION_IPV4 !== "undefined" ? FEDERATION_IPV4 : "127.0.0.1";
26
+ const remoteIpStrategy = typeof REMOTE_IP_STRATEGY !== "undefined" ? REMOTE_IP_STRATEGY : "inherit";
26
27
  function replaceObjectLocalhost(key, obj) {
28
+ if (remoteIpStrategy !== "ipv4") {
29
+ return;
30
+ }
27
31
  if (!(key in obj)) {
28
32
  return;
29
33
  }
@@ -36,10 +36,10 @@ module.exports = __toCommonJS(ssrPlugin_exports);
36
36
  var import_path = __toESM(require("path"));
37
37
  var import_utils = require("@modern-js/utils");
38
38
  var import_enhanced = require("@module-federation/enhanced");
39
+ var import_rspack = require("@module-federation/enhanced/rspack");
39
40
  var import_node = require("@module-federation/node");
40
41
  var import_manifest = require("./manifest");
41
- var import_constant = require("../constant");
42
- var import_constant2 = require("./constant");
42
+ var import_constant = require("./constant");
43
43
  function setEnv() {
44
44
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
45
45
  process.env["MF_SSR_PRJ"] = "true";
@@ -50,7 +50,7 @@ const moduleFederationSSRPlugin = (userConfig) => ({
50
50
  "@modern-js/plugin-module-federation-config",
51
51
  "@modern-js/plugin-module-federation"
52
52
  ],
53
- setup: async ({ useConfigContext }) => {
53
+ setup: async ({ useConfigContext, useAppContext }) => {
54
54
  var _modernjsConfig_server;
55
55
  const modernjsConfig = useConfigContext();
56
56
  const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
@@ -60,7 +60,7 @@ const moduleFederationSSRPlugin = (userConfig) => ({
60
60
  setEnv();
61
61
  return {
62
62
  _internalRuntimePlugins: ({ entrypoint, plugins }) => {
63
- if (!import_constant2.isDev) {
63
+ if (!import_constant.isDev) {
64
64
  return {
65
65
  entrypoint,
66
66
  plugins
@@ -77,25 +77,32 @@ const moduleFederationSSRPlugin = (userConfig) => ({
77
77
  };
78
78
  },
79
79
  config: async () => {
80
+ var _modernjsConfig_source, _modernjsConfig_source1;
81
+ const bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
82
+ var _modernjsConfig_source_enableAsyncEntry;
80
83
  return {
84
+ source: {
85
+ enableAsyncEntry: bundlerType === "rspack" ? (_modernjsConfig_source_enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry) !== null && _modernjsConfig_source_enableAsyncEntry !== void 0 ? _modernjsConfig_source_enableAsyncEntry : true : (_modernjsConfig_source1 = modernjsConfig.source) === null || _modernjsConfig_source1 === void 0 ? void 0 : _modernjsConfig_source1.enableAsyncEntry
86
+ },
81
87
  tools: {
82
88
  rspack(config, { isServer }) {
83
89
  if (isServer) {
84
- throw new Error(`${import_constant.PLUGIN_IDENTIFIER} Not support rspack ssr mode yet !`);
90
+ if (!userConfig.nodePlugin) {
91
+ var _config_plugins;
92
+ userConfig.nodePlugin = new import_rspack.ModuleFederationPlugin(userConfig.ssrConfig);
93
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
94
+ }
95
+ } else {
96
+ var _config_output;
97
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || import_path.default.resolve(process.cwd(), "dist");
85
98
  }
86
99
  },
87
100
  webpack(config, { isServer }) {
88
101
  if (isServer) {
89
- var _config_plugins;
90
102
  if (!userConfig.nodePlugin) {
91
- var _config_plugins1;
103
+ var _config_plugins;
92
104
  userConfig.nodePlugin = new import_enhanced.ModuleFederationPlugin(userConfig.ssrConfig);
93
- (_config_plugins1 = config.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(userConfig.nodePlugin);
94
- }
95
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(new import_node.StreamingTargetPlugin(userConfig.nodePlugin));
96
- if (import_constant2.isDev) {
97
- var _config_plugins2;
98
- (_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(new import_node.EntryChunkTrackerPlugin());
105
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
99
106
  }
100
107
  } else {
101
108
  var _config_output;
@@ -131,7 +138,13 @@ const moduleFederationSSRPlugin = (userConfig) => ({
131
138
  ]
132
139
  },
133
140
  bundlerChain(chain, { isServer }) {
134
- if (import_constant2.isDev && !isServer) {
141
+ if (isServer) {
142
+ chain.target("async-node");
143
+ if (import_constant.isDev) {
144
+ chain.plugin("UniverseEntryChunkTrackerPlugin").use(import_node.UniverseEntryChunkTrackerPlugin);
145
+ }
146
+ }
147
+ if (import_constant.isDev && !isServer) {
135
148
  chain.externals({
136
149
  "@module-federation/node/utils": "NOT_USED_IN_BROWSER"
137
150
  });
@@ -31,6 +31,7 @@ __export(utils_exports, {
31
31
  getIPV4: () => getIPV4,
32
32
  getMFConfig: () => getMFConfig,
33
33
  patchBundlerConfig: () => patchBundlerConfig,
34
+ patchIgnoreWarning: () => patchIgnoreWarning,
34
35
  patchMFConfig: () => patchMFConfig
35
36
  });
36
37
  module.exports = __toCommonJS(utils_exports);
@@ -138,6 +139,7 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
138
139
  injectRuntimePlugins(import_path.default.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
139
140
  }
140
141
  if (isServer) {
142
+ injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
141
143
  if (isDev) {
142
144
  injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
143
145
  }
@@ -168,11 +170,47 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
168
170
  mfConfig.dev = false;
169
171
  return mfConfig;
170
172
  };
173
+ function patchIgnoreWarning(bundlerConfig) {
174
+ bundlerConfig.ignoreWarnings = bundlerConfig.ignoreWarnings || [];
175
+ const ignoredMsgs = [
176
+ "external script",
177
+ "process.env.WS_NO_BUFFER_UTIL",
178
+ `Can't resolve 'utf-8-validate`
179
+ ];
180
+ bundlerConfig.ignoreWarnings.push((warning) => {
181
+ if (ignoredMsgs.some((msg) => warning.message.includes(msg))) {
182
+ return true;
183
+ }
184
+ return false;
185
+ });
186
+ }
171
187
  function patchBundlerConfig(options) {
172
188
  var _modernjsConfig_server, _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output, _modernjsConfig_deploy;
173
- const { bundlerConfig, modernjsConfig, isServer, mfConfig } = options;
189
+ const { bundlerConfig, modernjsConfig, isServer, mfConfig, bundlerType } = options;
174
190
  const enableSSR = Boolean((_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
175
191
  (_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? true : delete _bundlerConfig_optimization.runtimeChunk;
192
+ patchIgnoreWarning(bundlerConfig);
193
+ if (bundlerType === "webpack") {
194
+ bundlerConfig.watchOptions = bundlerConfig.watchOptions || {};
195
+ if (!Array.isArray(bundlerConfig.watchOptions.ignored)) {
196
+ if (bundlerConfig.watchOptions.ignored) {
197
+ bundlerConfig.watchOptions.ignored = [
198
+ bundlerConfig.watchOptions.ignored
199
+ ];
200
+ } else {
201
+ bundlerConfig.watchOptions.ignored = [];
202
+ }
203
+ }
204
+ if (mfConfig.dts !== false) {
205
+ if (typeof mfConfig.dts === "object" && typeof mfConfig.dts.consumeTypes === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
206
+ bundlerConfig.watchOptions.ignored.push(`**/${mfConfig.dts.consumeTypes.remoteTypesFolder}/**`);
207
+ } else {
208
+ bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
209
+ }
210
+ } else {
211
+ bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
212
+ }
213
+ }
176
214
  if (bundlerConfig.output) {
177
215
  var _bundlerConfig_output1, _bundlerConfig_output2;
178
216
  if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.chunkLoadingGlobal)) {
@@ -290,5 +328,6 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
290
328
  getIPV4,
291
329
  getMFConfig,
292
330
  patchBundlerConfig,
331
+ patchIgnoreWarning,
293
332
  patchMFConfig
294
333
  });
@@ -61,6 +61,7 @@ const mfConfig = {
61
61
  remoteType: "script",
62
62
  runtimePlugins: [
63
63
  import_path.default.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"),
64
+ require.resolve("@module-federation/node/runtimePlugin"),
64
65
  import_path.default.resolve(__dirname, "./mfRuntimePlugins/inject-node-fetch.js")
65
66
  ],
66
67
  shared: {
@@ -117,6 +118,7 @@ const mfConfig = {
117
118
  }
118
119
  };
119
120
  (0, import_utils.patchBundlerConfig)({
121
+ bundlerType: "webpack",
120
122
  bundlerConfig,
121
123
  isServer: true,
122
124
  modernjsConfig: {
@@ -128,13 +130,20 @@ const mfConfig = {
128
130
  },
129
131
  mfConfig
130
132
  });
131
- (0, import_vitest.expect)(bundlerConfig).toStrictEqual({
133
+ const expectedConfig = {
132
134
  output: {
133
135
  chunkLoadingGlobal: "chunk_host",
134
136
  publicPath: "auto",
135
137
  uniqueName: "host"
138
+ },
139
+ watchOptions: {
140
+ ignored: [
141
+ "**/@mf-types/**"
142
+ ]
136
143
  }
137
- });
144
+ };
145
+ bundlerConfig === null || bundlerConfig === void 0 ? true : delete bundlerConfig.ignoreWarnings;
146
+ (0, import_vitest.expect)(bundlerConfig).toStrictEqual(expectedConfig);
138
147
  });
139
148
  (0, import_vitest.it)("patchBundlerConfig: client", async () => {
140
149
  const bundlerConfig = {
@@ -143,6 +152,7 @@ const mfConfig = {
143
152
  }
144
153
  };
145
154
  (0, import_utils.patchBundlerConfig)({
155
+ bundlerType: "webpack",
146
156
  bundlerConfig,
147
157
  isServer: false,
148
158
  modernjsConfig: {
@@ -154,12 +164,19 @@ const mfConfig = {
154
164
  },
155
165
  mfConfig
156
166
  });
157
- (0, import_vitest.expect)(bundlerConfig).toStrictEqual({
167
+ const expectedConfig = {
158
168
  output: {
159
169
  chunkLoadingGlobal: "chunk_host",
160
170
  publicPath: "auto",
161
171
  uniqueName: "host"
172
+ },
173
+ watchOptions: {
174
+ ignored: [
175
+ "**/@mf-types/**"
176
+ ]
162
177
  }
163
- });
178
+ };
179
+ bundlerConfig === null || bundlerConfig === void 0 ? true : delete bundlerConfig.ignoreWarnings;
180
+ (0, import_vitest.expect)(bundlerConfig).toStrictEqual(expectedConfig);
164
181
  });
165
182
  });
@@ -9,23 +9,15 @@ function setEnv(enableSSR) {
9
9
  }
10
10
  }
11
11
  function modifyBundlerConfig(options) {
12
- var mfConfig = options.mfConfig, config = options.config, isServer = options.isServer, modernjsConfig = options.modernjsConfig, bundlerType = options.bundlerType, _options_remoteIpStrategy = options.remoteIpStrategy, remoteIpStrategy = _options_remoteIpStrategy === void 0 ? "ipv4" : _options_remoteIpStrategy;
12
+ var mfConfig = options.mfConfig, config = options.config, isServer = options.isServer, modernjsConfig = options.modernjsConfig, _options_remoteIpStrategy = options.remoteIpStrategy, remoteIpStrategy = _options_remoteIpStrategy === void 0 ? "ipv4" : _options_remoteIpStrategy, bundlerType = options.bundlerType;
13
13
  patchMFConfig(mfConfig, isServer, remoteIpStrategy);
14
14
  patchBundlerConfig({
15
+ bundlerType,
15
16
  bundlerConfig: config,
16
17
  isServer,
17
18
  modernjsConfig,
18
19
  mfConfig
19
20
  });
20
- if (bundlerType === "webpack") {
21
- config.ignoreWarnings = config.ignoreWarnings || [];
22
- config.ignoreWarnings.push(function(warning) {
23
- if (warning.message.includes("external script")) {
24
- return true;
25
- }
26
- return false;
27
- });
28
- }
29
21
  }
30
22
  var moduleFederationConfigPlugin = function(userConfig) {
31
23
  return {
@@ -55,10 +47,18 @@ var moduleFederationConfigPlugin = function(userConfig) {
55
47
  2,
56
48
  {
57
49
  config: /* @__PURE__ */ _async_to_generator(function() {
58
- var _modernjsConfig_dev, bundlerType, ipv4;
50
+ var _modernjsConfig_server, _modernjsConfig_dev, bundlerType, ipv4, enableSSR;
59
51
  return _ts_generator(this, function(_state2) {
60
52
  bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
61
53
  ipv4 = getIPV4();
54
+ enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
55
+ if (userConfig.remoteIpStrategy === void 0) {
56
+ if (!enableSSR) {
57
+ userConfig.remoteIpStrategy = "inherit";
58
+ } else {
59
+ userConfig.remoteIpStrategy = "ipv4";
60
+ }
61
+ }
62
62
  return [
63
63
  2,
64
64
  {
@@ -102,7 +102,8 @@ var moduleFederationConfigPlugin = function(userConfig) {
102
102
  "@modern-js/runtime/mf": require.resolve("@module-federation/modern-js/runtime")
103
103
  },
104
104
  define: {
105
- FEDERATION_IPV4: JSON.stringify(ipv4)
105
+ FEDERATION_IPV4: JSON.stringify(ipv4),
106
+ REMOTE_IP_STRATEGY: JSON.stringify(userConfig.remoteIpStrategy)
106
107
  }
107
108
  },
108
109
  dev: {
@@ -2,7 +2,11 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
2
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
3
  import { LOCALHOST } from "../../constant";
4
4
  var ipv4 = typeof FEDERATION_IPV4 !== "undefined" ? FEDERATION_IPV4 : "127.0.0.1";
5
+ var remoteIpStrategy = typeof REMOTE_IP_STRATEGY !== "undefined" ? REMOTE_IP_STRATEGY : "inherit";
5
6
  function replaceObjectLocalhost(key, obj) {
7
+ if (remoteIpStrategy !== "ipv4") {
8
+ return;
9
+ }
6
10
  if (!(key in obj)) {
7
11
  return;
8
12
  }
@@ -3,9 +3,9 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
3
  import path from "path";
4
4
  import { fs } from "@modern-js/utils";
5
5
  import { ModuleFederationPlugin } from "@module-federation/enhanced";
6
- import { StreamingTargetPlugin, EntryChunkTrackerPlugin } from "@module-federation/node";
6
+ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
7
+ import { UniverseEntryChunkTrackerPlugin } from "@module-federation/node";
7
8
  import { updateStatsAndManifest } from "./manifest";
8
- import { PLUGIN_IDENTIFIER } from "../constant";
9
9
  import { isDev } from "./constant";
10
10
  function setEnv() {
11
11
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
@@ -20,9 +20,9 @@ var moduleFederationSSRPlugin = function(userConfig) {
20
20
  ],
21
21
  setup: function() {
22
22
  var _ref = _async_to_generator(function(param) {
23
- var useConfigContext, _modernjsConfig_server, modernjsConfig, enableSSR;
23
+ var useConfigContext, useAppContext, _modernjsConfig_server, modernjsConfig, enableSSR;
24
24
  return _ts_generator(this, function(_state) {
25
- useConfigContext = param.useConfigContext;
25
+ useConfigContext = param.useConfigContext, useAppContext = param.useAppContext;
26
26
  modernjsConfig = useConfigContext();
27
27
  enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
28
28
  if (!enableSSR) {
@@ -54,30 +54,36 @@ var moduleFederationSSRPlugin = function(userConfig) {
54
54
  };
55
55
  },
56
56
  config: /* @__PURE__ */ _async_to_generator(function() {
57
+ var _modernjsConfig_source, _modernjsConfig_source1, bundlerType, _modernjsConfig_source_enableAsyncEntry;
57
58
  return _ts_generator(this, function(_state2) {
59
+ bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
58
60
  return [
59
61
  2,
60
62
  {
63
+ source: {
64
+ enableAsyncEntry: bundlerType === "rspack" ? (_modernjsConfig_source_enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry) !== null && _modernjsConfig_source_enableAsyncEntry !== void 0 ? _modernjsConfig_source_enableAsyncEntry : true : (_modernjsConfig_source1 = modernjsConfig.source) === null || _modernjsConfig_source1 === void 0 ? void 0 : _modernjsConfig_source1.enableAsyncEntry
65
+ },
61
66
  tools: {
62
67
  rspack: function rspack(config, param2) {
63
68
  var isServer = param2.isServer;
64
69
  if (isServer) {
65
- throw new Error("".concat(PLUGIN_IDENTIFIER, " Not support rspack ssr mode yet !"));
70
+ if (!userConfig.nodePlugin) {
71
+ var _config_plugins;
72
+ userConfig.nodePlugin = new RspackModuleFederationPlugin(userConfig.ssrConfig);
73
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
74
+ }
75
+ } else {
76
+ var _config_output;
77
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
66
78
  }
67
79
  },
68
80
  webpack: function webpack(config, param2) {
69
81
  var isServer = param2.isServer;
70
82
  if (isServer) {
71
- var _config_plugins;
72
83
  if (!userConfig.nodePlugin) {
73
- var _config_plugins1;
84
+ var _config_plugins;
74
85
  userConfig.nodePlugin = new ModuleFederationPlugin(userConfig.ssrConfig);
75
- (_config_plugins1 = config.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(userConfig.nodePlugin);
76
- }
77
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(new StreamingTargetPlugin(userConfig.nodePlugin));
78
- if (isDev) {
79
- var _config_plugins2;
80
- (_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(new EntryChunkTrackerPlugin());
86
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
81
87
  }
82
88
  } else {
83
89
  var _config_output;
@@ -114,6 +120,12 @@ var moduleFederationSSRPlugin = function(userConfig) {
114
120
  },
115
121
  bundlerChain: function bundlerChain(chain, param2) {
116
122
  var isServer = param2.isServer;
123
+ if (isServer) {
124
+ chain.target("async-node");
125
+ if (isDev) {
126
+ chain.plugin("UniverseEntryChunkTrackerPlugin").use(UniverseEntryChunkTrackerPlugin);
127
+ }
128
+ }
117
129
  if (isDev && !isServer) {
118
130
  chain.externals({
119
131
  "@module-federation/node/utils": "NOT_USED_IN_BROWSER"
@@ -132,6 +132,7 @@ var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy) {
132
132
  injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
133
133
  }
134
134
  if (isServer) {
135
+ injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
135
136
  if (isDev) {
136
137
  injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
137
138
  }
@@ -162,11 +163,49 @@ var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy) {
162
163
  mfConfig.dev = false;
163
164
  return mfConfig;
164
165
  };
166
+ function patchIgnoreWarning(bundlerConfig) {
167
+ bundlerConfig.ignoreWarnings = bundlerConfig.ignoreWarnings || [];
168
+ var ignoredMsgs = [
169
+ "external script",
170
+ "process.env.WS_NO_BUFFER_UTIL",
171
+ "Can't resolve 'utf-8-validate"
172
+ ];
173
+ bundlerConfig.ignoreWarnings.push(function(warning) {
174
+ if (ignoredMsgs.some(function(msg) {
175
+ return warning.message.includes(msg);
176
+ })) {
177
+ return true;
178
+ }
179
+ return false;
180
+ });
181
+ }
165
182
  function patchBundlerConfig(options) {
166
183
  var _modernjsConfig_server, _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output, _modernjsConfig_deploy;
167
- var bundlerConfig = options.bundlerConfig, modernjsConfig = options.modernjsConfig, isServer = options.isServer, mfConfig = options.mfConfig;
184
+ var bundlerConfig = options.bundlerConfig, modernjsConfig = options.modernjsConfig, isServer = options.isServer, mfConfig = options.mfConfig, bundlerType = options.bundlerType;
168
185
  var enableSSR = Boolean((_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
169
186
  (_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? true : delete _bundlerConfig_optimization.runtimeChunk;
187
+ patchIgnoreWarning(bundlerConfig);
188
+ if (bundlerType === "webpack") {
189
+ bundlerConfig.watchOptions = bundlerConfig.watchOptions || {};
190
+ if (!Array.isArray(bundlerConfig.watchOptions.ignored)) {
191
+ if (bundlerConfig.watchOptions.ignored) {
192
+ bundlerConfig.watchOptions.ignored = [
193
+ bundlerConfig.watchOptions.ignored
194
+ ];
195
+ } else {
196
+ bundlerConfig.watchOptions.ignored = [];
197
+ }
198
+ }
199
+ if (mfConfig.dts !== false) {
200
+ if (typeof mfConfig.dts === "object" && typeof mfConfig.dts.consumeTypes === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
201
+ bundlerConfig.watchOptions.ignored.push("**/".concat(mfConfig.dts.consumeTypes.remoteTypesFolder, "/**"));
202
+ } else {
203
+ bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
204
+ }
205
+ } else {
206
+ bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
207
+ }
208
+ }
170
209
  if (bundlerConfig.output) {
171
210
  var _bundlerConfig_output1, _bundlerConfig_output2;
172
211
  if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.chunkLoadingGlobal)) {
@@ -299,5 +338,6 @@ export {
299
338
  getIPV4,
300
339
  getMFConfig,
301
340
  patchBundlerConfig,
341
+ patchIgnoreWarning,
302
342
  patchMFConfig
303
343
  };
@@ -43,6 +43,7 @@ describe("patchMFConfig", /* @__PURE__ */ _async_to_generator(function() {
43
43
  remoteType: "script",
44
44
  runtimePlugins: [
45
45
  path.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"),
46
+ require.resolve("@module-federation/node/runtimePlugin"),
46
47
  path.resolve(__dirname, "./mfRuntimePlugins/inject-node-fetch.js")
47
48
  ],
48
49
  shared: {
@@ -108,7 +109,7 @@ describe("patchMFConfig", /* @__PURE__ */ _async_to_generator(function() {
108
109
  describe("patchBundlerConfig", /* @__PURE__ */ _async_to_generator(function() {
109
110
  return _ts_generator(this, function(_state) {
110
111
  it("patchBundlerConfig: server", /* @__PURE__ */ _async_to_generator(function() {
111
- var bundlerConfig;
112
+ var bundlerConfig, expectedConfig;
112
113
  return _ts_generator(this, function(_state2) {
113
114
  bundlerConfig = {
114
115
  output: {
@@ -116,6 +117,7 @@ describe("patchBundlerConfig", /* @__PURE__ */ _async_to_generator(function() {
116
117
  }
117
118
  };
118
119
  patchBundlerConfig({
120
+ bundlerType: "webpack",
119
121
  bundlerConfig,
120
122
  isServer: true,
121
123
  modernjsConfig: {
@@ -127,20 +129,27 @@ describe("patchBundlerConfig", /* @__PURE__ */ _async_to_generator(function() {
127
129
  },
128
130
  mfConfig
129
131
  });
130
- expect(bundlerConfig).toStrictEqual({
132
+ expectedConfig = {
131
133
  output: {
132
134
  chunkLoadingGlobal: "chunk_host",
133
135
  publicPath: "auto",
134
136
  uniqueName: "host"
137
+ },
138
+ watchOptions: {
139
+ ignored: [
140
+ "**/@mf-types/**"
141
+ ]
135
142
  }
136
- });
143
+ };
144
+ bundlerConfig === null || bundlerConfig === void 0 ? true : delete bundlerConfig.ignoreWarnings;
145
+ expect(bundlerConfig).toStrictEqual(expectedConfig);
137
146
  return [
138
147
  2
139
148
  ];
140
149
  });
141
150
  }));
142
151
  it("patchBundlerConfig: client", /* @__PURE__ */ _async_to_generator(function() {
143
- var bundlerConfig;
152
+ var bundlerConfig, expectedConfig;
144
153
  return _ts_generator(this, function(_state2) {
145
154
  bundlerConfig = {
146
155
  output: {
@@ -148,6 +157,7 @@ describe("patchBundlerConfig", /* @__PURE__ */ _async_to_generator(function() {
148
157
  }
149
158
  };
150
159
  patchBundlerConfig({
160
+ bundlerType: "webpack",
151
161
  bundlerConfig,
152
162
  isServer: false,
153
163
  modernjsConfig: {
@@ -159,13 +169,20 @@ describe("patchBundlerConfig", /* @__PURE__ */ _async_to_generator(function() {
159
169
  },
160
170
  mfConfig
161
171
  });
162
- expect(bundlerConfig).toStrictEqual({
172
+ expectedConfig = {
163
173
  output: {
164
174
  chunkLoadingGlobal: "chunk_host",
165
175
  publicPath: "auto",
166
176
  uniqueName: "host"
177
+ },
178
+ watchOptions: {
179
+ ignored: [
180
+ "**/@mf-types/**"
181
+ ]
167
182
  }
168
- });
183
+ };
184
+ bundlerConfig === null || bundlerConfig === void 0 ? true : delete bundlerConfig.ignoreWarnings;
185
+ expect(bundlerConfig).toStrictEqual(expectedConfig);
169
186
  return [
170
187
  2
171
188
  ];
@@ -7,23 +7,15 @@ function setEnv(enableSSR) {
7
7
  }
8
8
  }
9
9
  function modifyBundlerConfig(options) {
10
- const { mfConfig, config, isServer, modernjsConfig, bundlerType, remoteIpStrategy = "ipv4" } = options;
10
+ const { mfConfig, config, isServer, modernjsConfig, remoteIpStrategy = "ipv4", bundlerType } = options;
11
11
  patchMFConfig(mfConfig, isServer, remoteIpStrategy);
12
12
  patchBundlerConfig({
13
+ bundlerType,
13
14
  bundlerConfig: config,
14
15
  isServer,
15
16
  modernjsConfig,
16
17
  mfConfig
17
18
  });
18
- if (bundlerType === "webpack") {
19
- config.ignoreWarnings = config.ignoreWarnings || [];
20
- config.ignoreWarnings.push((warning) => {
21
- if (warning.message.includes("external script")) {
22
- return true;
23
- }
24
- return false;
25
- });
26
- }
27
19
  }
28
20
  const moduleFederationConfigPlugin = (userConfig) => ({
29
21
  name: "@modern-js/plugin-module-federation-config",
@@ -39,9 +31,17 @@ const moduleFederationConfigPlugin = (userConfig) => ({
39
31
  userConfig.csrConfig = csrConfig;
40
32
  return {
41
33
  config: async () => {
42
- var _modernjsConfig_dev;
34
+ var _modernjsConfig_server, _modernjsConfig_dev;
43
35
  const bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
44
36
  const ipv4 = getIPV4();
37
+ const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
38
+ if (userConfig.remoteIpStrategy === void 0) {
39
+ if (!enableSSR) {
40
+ userConfig.remoteIpStrategy = "inherit";
41
+ } else {
42
+ userConfig.remoteIpStrategy = "ipv4";
43
+ }
44
+ }
45
45
  return {
46
46
  tools: {
47
47
  rspack(config, { isServer }) {
@@ -81,7 +81,8 @@ const moduleFederationConfigPlugin = (userConfig) => ({
81
81
  "@modern-js/runtime/mf": require.resolve("@module-federation/modern-js/runtime")
82
82
  },
83
83
  define: {
84
- FEDERATION_IPV4: JSON.stringify(ipv4)
84
+ FEDERATION_IPV4: JSON.stringify(ipv4),
85
+ REMOTE_IP_STRATEGY: JSON.stringify(userConfig.remoteIpStrategy)
85
86
  }
86
87
  },
87
88
  dev: {
@@ -1,6 +1,10 @@
1
1
  import { LOCALHOST } from "../../constant";
2
2
  const ipv4 = typeof FEDERATION_IPV4 !== "undefined" ? FEDERATION_IPV4 : "127.0.0.1";
3
+ const remoteIpStrategy = typeof REMOTE_IP_STRATEGY !== "undefined" ? REMOTE_IP_STRATEGY : "inherit";
3
4
  function replaceObjectLocalhost(key, obj) {
5
+ if (remoteIpStrategy !== "ipv4") {
6
+ return;
7
+ }
4
8
  if (!(key in obj)) {
5
9
  return;
6
10
  }
@@ -1,9 +1,9 @@
1
1
  import path from "path";
2
2
  import { fs } from "@modern-js/utils";
3
3
  import { ModuleFederationPlugin } from "@module-federation/enhanced";
4
- import { StreamingTargetPlugin, EntryChunkTrackerPlugin } from "@module-federation/node";
4
+ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
5
+ import { UniverseEntryChunkTrackerPlugin } from "@module-federation/node";
5
6
  import { updateStatsAndManifest } from "./manifest";
6
- import { PLUGIN_IDENTIFIER } from "../constant";
7
7
  import { isDev } from "./constant";
8
8
  function setEnv() {
9
9
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
@@ -15,7 +15,7 @@ const moduleFederationSSRPlugin = (userConfig) => ({
15
15
  "@modern-js/plugin-module-federation-config",
16
16
  "@modern-js/plugin-module-federation"
17
17
  ],
18
- setup: async ({ useConfigContext }) => {
18
+ setup: async ({ useConfigContext, useAppContext }) => {
19
19
  var _modernjsConfig_server;
20
20
  const modernjsConfig = useConfigContext();
21
21
  const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
@@ -42,25 +42,32 @@ const moduleFederationSSRPlugin = (userConfig) => ({
42
42
  };
43
43
  },
44
44
  config: async () => {
45
+ var _modernjsConfig_source, _modernjsConfig_source1;
46
+ const bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
47
+ var _modernjsConfig_source_enableAsyncEntry;
45
48
  return {
49
+ source: {
50
+ enableAsyncEntry: bundlerType === "rspack" ? (_modernjsConfig_source_enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry) !== null && _modernjsConfig_source_enableAsyncEntry !== void 0 ? _modernjsConfig_source_enableAsyncEntry : true : (_modernjsConfig_source1 = modernjsConfig.source) === null || _modernjsConfig_source1 === void 0 ? void 0 : _modernjsConfig_source1.enableAsyncEntry
51
+ },
46
52
  tools: {
47
53
  rspack(config, { isServer }) {
48
54
  if (isServer) {
49
- throw new Error(`${PLUGIN_IDENTIFIER} Not support rspack ssr mode yet !`);
55
+ if (!userConfig.nodePlugin) {
56
+ var _config_plugins;
57
+ userConfig.nodePlugin = new RspackModuleFederationPlugin(userConfig.ssrConfig);
58
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
59
+ }
60
+ } else {
61
+ var _config_output;
62
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
50
63
  }
51
64
  },
52
65
  webpack(config, { isServer }) {
53
66
  if (isServer) {
54
- var _config_plugins;
55
67
  if (!userConfig.nodePlugin) {
56
- var _config_plugins1;
68
+ var _config_plugins;
57
69
  userConfig.nodePlugin = new ModuleFederationPlugin(userConfig.ssrConfig);
58
- (_config_plugins1 = config.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(userConfig.nodePlugin);
59
- }
60
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(new StreamingTargetPlugin(userConfig.nodePlugin));
61
- if (isDev) {
62
- var _config_plugins2;
63
- (_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(new EntryChunkTrackerPlugin());
70
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
64
71
  }
65
72
  } else {
66
73
  var _config_output;
@@ -96,6 +103,12 @@ const moduleFederationSSRPlugin = (userConfig) => ({
96
103
  ]
97
104
  },
98
105
  bundlerChain(chain, { isServer }) {
106
+ if (isServer) {
107
+ chain.target("async-node");
108
+ if (isDev) {
109
+ chain.plugin("UniverseEntryChunkTrackerPlugin").use(UniverseEntryChunkTrackerPlugin);
110
+ }
111
+ }
99
112
  if (isDev && !isServer) {
100
113
  chain.externals({
101
114
  "@module-federation/node/utils": "NOT_USED_IN_BROWSER"
@@ -102,6 +102,7 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
102
102
  injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
103
103
  }
104
104
  if (isServer) {
105
+ injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
105
106
  if (isDev) {
106
107
  injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
107
108
  }
@@ -132,11 +133,47 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
132
133
  mfConfig.dev = false;
133
134
  return mfConfig;
134
135
  };
136
+ function patchIgnoreWarning(bundlerConfig) {
137
+ bundlerConfig.ignoreWarnings = bundlerConfig.ignoreWarnings || [];
138
+ const ignoredMsgs = [
139
+ "external script",
140
+ "process.env.WS_NO_BUFFER_UTIL",
141
+ `Can't resolve 'utf-8-validate`
142
+ ];
143
+ bundlerConfig.ignoreWarnings.push((warning) => {
144
+ if (ignoredMsgs.some((msg) => warning.message.includes(msg))) {
145
+ return true;
146
+ }
147
+ return false;
148
+ });
149
+ }
135
150
  function patchBundlerConfig(options) {
136
151
  var _modernjsConfig_server, _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output, _modernjsConfig_deploy;
137
- const { bundlerConfig, modernjsConfig, isServer, mfConfig } = options;
152
+ const { bundlerConfig, modernjsConfig, isServer, mfConfig, bundlerType } = options;
138
153
  const enableSSR = Boolean((_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
139
154
  (_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? true : delete _bundlerConfig_optimization.runtimeChunk;
155
+ patchIgnoreWarning(bundlerConfig);
156
+ if (bundlerType === "webpack") {
157
+ bundlerConfig.watchOptions = bundlerConfig.watchOptions || {};
158
+ if (!Array.isArray(bundlerConfig.watchOptions.ignored)) {
159
+ if (bundlerConfig.watchOptions.ignored) {
160
+ bundlerConfig.watchOptions.ignored = [
161
+ bundlerConfig.watchOptions.ignored
162
+ ];
163
+ } else {
164
+ bundlerConfig.watchOptions.ignored = [];
165
+ }
166
+ }
167
+ if (mfConfig.dts !== false) {
168
+ if (typeof mfConfig.dts === "object" && typeof mfConfig.dts.consumeTypes === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
169
+ bundlerConfig.watchOptions.ignored.push(`**/${mfConfig.dts.consumeTypes.remoteTypesFolder}/**`);
170
+ } else {
171
+ bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
172
+ }
173
+ } else {
174
+ bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
175
+ }
176
+ }
140
177
  if (bundlerConfig.output) {
141
178
  var _bundlerConfig_output1, _bundlerConfig_output2;
142
179
  if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.chunkLoadingGlobal)) {
@@ -253,5 +290,6 @@ export {
253
290
  getIPV4,
254
291
  getMFConfig,
255
292
  patchBundlerConfig,
293
+ patchIgnoreWarning,
256
294
  patchMFConfig
257
295
  };
@@ -38,6 +38,7 @@ describe("patchMFConfig", async () => {
38
38
  remoteType: "script",
39
39
  runtimePlugins: [
40
40
  path.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"),
41
+ require.resolve("@module-federation/node/runtimePlugin"),
41
42
  path.resolve(__dirname, "./mfRuntimePlugins/inject-node-fetch.js")
42
43
  ],
43
44
  shared: {
@@ -94,6 +95,7 @@ describe("patchBundlerConfig", async () => {
94
95
  }
95
96
  };
96
97
  patchBundlerConfig({
98
+ bundlerType: "webpack",
97
99
  bundlerConfig,
98
100
  isServer: true,
99
101
  modernjsConfig: {
@@ -105,13 +107,20 @@ describe("patchBundlerConfig", async () => {
105
107
  },
106
108
  mfConfig
107
109
  });
108
- expect(bundlerConfig).toStrictEqual({
110
+ const expectedConfig = {
109
111
  output: {
110
112
  chunkLoadingGlobal: "chunk_host",
111
113
  publicPath: "auto",
112
114
  uniqueName: "host"
115
+ },
116
+ watchOptions: {
117
+ ignored: [
118
+ "**/@mf-types/**"
119
+ ]
113
120
  }
114
- });
121
+ };
122
+ bundlerConfig === null || bundlerConfig === void 0 ? true : delete bundlerConfig.ignoreWarnings;
123
+ expect(bundlerConfig).toStrictEqual(expectedConfig);
115
124
  });
116
125
  it("patchBundlerConfig: client", async () => {
117
126
  const bundlerConfig = {
@@ -120,6 +129,7 @@ describe("patchBundlerConfig", async () => {
120
129
  }
121
130
  };
122
131
  patchBundlerConfig({
132
+ bundlerType: "webpack",
123
133
  bundlerConfig,
124
134
  isServer: false,
125
135
  modernjsConfig: {
@@ -131,12 +141,19 @@ describe("patchBundlerConfig", async () => {
131
141
  },
132
142
  mfConfig
133
143
  });
134
- expect(bundlerConfig).toStrictEqual({
144
+ const expectedConfig = {
135
145
  output: {
136
146
  chunkLoadingGlobal: "chunk_host",
137
147
  publicPath: "auto",
138
148
  uniqueName: "host"
149
+ },
150
+ watchOptions: {
151
+ ignored: [
152
+ "**/@mf-types/**"
153
+ ]
139
154
  }
140
- });
155
+ };
156
+ bundlerConfig === null || bundlerConfig === void 0 ? true : delete bundlerConfig.ignoreWarnings;
157
+ expect(bundlerConfig).toStrictEqual(expectedConfig);
141
158
  });
142
159
  });
@@ -5,10 +5,12 @@ import { BundlerConfig } from '../interfaces/bundler';
5
5
  export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T extends 'rspack' ? Rspack.Configuration : never;
6
6
  export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
7
7
  export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean, remoteIpStrategy?: "ipv4" | "inherit") => moduleFederationPlugin.ModuleFederationPluginOptions;
8
+ export declare function patchIgnoreWarning<T extends Bundler>(bundlerConfig: BundlerConfig<T>): void;
8
9
  export declare function patchBundlerConfig<T extends Bundler>(options: {
9
10
  bundlerConfig: BundlerConfig<T>;
10
11
  isServer: boolean;
11
12
  modernjsConfig: UserConfig<AppTools>;
13
+ bundlerType: Bundler;
12
14
  mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
13
15
  }): void;
14
16
  export declare const getIPV4: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -61,18 +61,18 @@
61
61
  "node-fetch": "~3.3.0",
62
62
  "react-error-boundary": "4.0.13",
63
63
  "hoist-non-react-statics": "3.3.2",
64
- "@module-federation/sdk": "0.3.1",
65
- "@module-federation/enhanced": "0.3.1",
66
- "@module-federation/node": "2.5.1"
64
+ "@module-federation/sdk": "0.3.3",
65
+ "@module-federation/enhanced": "0.3.3",
66
+ "@module-federation/node": "2.5.3"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/hoist-non-react-statics": "3.3.2",
70
- "@modern-js/app-tools": "2.56.1",
71
- "@modern-js/core": "2.56.1",
72
- "@modern-js/runtime": "2.56.1",
73
- "@modern-js/module-tools": "2.56.1",
74
- "@modern-js/tsconfig": "2.56.1",
75
- "@module-federation/manifest": "0.3.1"
70
+ "@modern-js/app-tools": "2.56.2",
71
+ "@modern-js/core": "2.56.2",
72
+ "@modern-js/runtime": "2.56.2",
73
+ "@modern-js/module-tools": "2.56.2",
74
+ "@modern-js/tsconfig": "2.56.2",
75
+ "@module-federation/manifest": "0.3.3"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "react": ">=17",