@module-federation/modern-js 0.0.0-next-20240516132001 → 0.0.0-next-20240519072927
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/cjs/cli/index.js +10 -9
- package/dist/cjs/cli/utils.js +19 -11
- package/dist/cjs/runtime/ssr-runtime.js +1 -0
- package/dist/esm/cli/index.js +10 -9
- package/dist/esm/cli/utils.js +19 -11
- package/dist/esm/runtime/ssr-runtime.js +0 -0
- package/dist/esm-node/cli/index.js +10 -9
- package/dist/esm-node/cli/utils.js +19 -11
- package/dist/esm-node/runtime/ssr-runtime.js +0 -0
- package/dist/types/cli/utils.d.ts +3 -2
- package/dist/types/runtime/ssr-runtime.d.ts +0 -0
- package/package.json +5 -5
package/dist/cjs/cli/index.js
CHANGED
|
@@ -45,9 +45,9 @@ var import_enhanced2 = require("@module-federation/enhanced");
|
|
|
45
45
|
const moduleFederationPlugin = (userConfig = {}) => ({
|
|
46
46
|
name: "@modern-js/plugin-module-federation",
|
|
47
47
|
setup: async ({ useConfigContext, useAppContext }) => {
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
const enableSSR = Boolean(
|
|
48
|
+
var _modernjsConfig_server;
|
|
49
|
+
const modernjsConfig = useConfigContext();
|
|
50
|
+
const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
|
|
51
51
|
const mfConfig = await (0, import_utils2.getMFConfig)(userConfig);
|
|
52
52
|
let outputDir = "";
|
|
53
53
|
const bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
|
|
@@ -58,7 +58,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
58
58
|
let nodePlugin;
|
|
59
59
|
return {
|
|
60
60
|
config: () => {
|
|
61
|
-
var
|
|
61
|
+
var _modernjsConfig_dev;
|
|
62
62
|
if (enableSSR) {
|
|
63
63
|
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
|
64
64
|
process.env["MF_SSR_PRJ"] = "true";
|
|
@@ -77,9 +77,10 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
77
77
|
(_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(browserPlugin);
|
|
78
78
|
}
|
|
79
79
|
(0, import_utils2.patchWebpackConfig)({
|
|
80
|
-
config,
|
|
80
|
+
bundlerConfig: config,
|
|
81
81
|
isServer,
|
|
82
|
-
|
|
82
|
+
modernjsConfig,
|
|
83
|
+
mfConfig: envConfig
|
|
83
84
|
});
|
|
84
85
|
};
|
|
85
86
|
return {
|
|
@@ -88,9 +89,9 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
88
89
|
modifyBundlerConfig(config, false);
|
|
89
90
|
},
|
|
90
91
|
webpack(config, { isServer }) {
|
|
91
|
-
var
|
|
92
|
+
var _modernjsConfig_source;
|
|
92
93
|
modifyBundlerConfig(config, isServer);
|
|
93
|
-
const enableAsyncEntry = (
|
|
94
|
+
const enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry;
|
|
94
95
|
if (mfConfig.async || !enableAsyncEntry && mfConfig.async !== false) {
|
|
95
96
|
var _config_plugins;
|
|
96
97
|
const asyncBoundaryPluginOptions = typeof mfConfig.async === "object" ? mfConfig.async : {
|
|
@@ -139,7 +140,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
139
140
|
}
|
|
140
141
|
},
|
|
141
142
|
dev: {
|
|
142
|
-
assetPrefix: (
|
|
143
|
+
assetPrefix: (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.assetPrefix) ? modernjsConfig.dev.assetPrefix : true
|
|
143
144
|
}
|
|
144
145
|
};
|
|
145
146
|
},
|
package/dist/cjs/cli/utils.js
CHANGED
|
@@ -81,20 +81,28 @@ function getTargetEnvConfig(mfConfig, isServer) {
|
|
|
81
81
|
return mfConfig;
|
|
82
82
|
}
|
|
83
83
|
function patchWebpackConfig(options) {
|
|
84
|
-
var
|
|
85
|
-
const {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
(
|
|
89
|
-
|
|
90
|
-
config.optimization.splitChunks.chunks = "async";
|
|
84
|
+
var _modernjsConfig_server, _modernjsConfig_server_ssr, _modernjsConfig_server1, _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output;
|
|
85
|
+
const { bundlerConfig, modernjsConfig, isServer, mfConfig } = options;
|
|
86
|
+
const isStreamSSR = typeof (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr) === "object" ? (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server1 = modernjsConfig.server) === null || _modernjsConfig_server1 === void 0 ? void 0 : (_modernjsConfig_server_ssr = _modernjsConfig_server1.ssr) === null || _modernjsConfig_server_ssr === void 0 ? void 0 : _modernjsConfig_server_ssr.mode) === "stream" : false;
|
|
87
|
+
(_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? true : delete _bundlerConfig_optimization.runtimeChunk;
|
|
88
|
+
if (!isServer && isStreamSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
89
|
+
bundlerConfig.optimization.splitChunks.chunks = "async";
|
|
91
90
|
console.warn('[Modern.js Module Federation] splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"');
|
|
92
91
|
}
|
|
93
|
-
if (((
|
|
94
|
-
var
|
|
95
|
-
const port = ((
|
|
92
|
+
if (((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
|
|
93
|
+
var _modernjsConfig_dev, _modernjsConfig_server2;
|
|
94
|
+
const port = ((_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.port) || ((_modernjsConfig_server2 = modernjsConfig.server) === null || _modernjsConfig_server2 === void 0 ? void 0 : _modernjsConfig_server2.port) || 8080;
|
|
96
95
|
const publicPath = `http://localhost:${port}/`;
|
|
97
|
-
|
|
96
|
+
bundlerConfig.output.publicPath = publicPath;
|
|
97
|
+
}
|
|
98
|
+
if (isServer && isStreamSSR) {
|
|
99
|
+
const { output } = bundlerConfig;
|
|
100
|
+
const uniqueName = mfConfig.name || (output === null || output === void 0 ? void 0 : output.uniqueName);
|
|
101
|
+
const chunkFileName = output === null || output === void 0 ? void 0 : output.chunkFilename;
|
|
102
|
+
if (output && typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
103
|
+
const suffix = `-[chunkhash].js`;
|
|
104
|
+
output.chunkFilename = chunkFileName.replace(".js", suffix);
|
|
105
|
+
}
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -14,13 +14,13 @@ var moduleFederationPlugin = function() {
|
|
|
14
14
|
name: "@modern-js/plugin-module-federation",
|
|
15
15
|
setup: function() {
|
|
16
16
|
var _ref = _async_to_generator(function(param) {
|
|
17
|
-
var useConfigContext, useAppContext,
|
|
17
|
+
var useConfigContext, useAppContext, _modernjsConfig_server, modernjsConfig, enableSSR, mfConfig, outputDir, bundlerType, WebpackPluginConstructor, RspackPluginConstructor, MFBundlerPlugin, browserPlugin, nodePlugin;
|
|
18
18
|
return _ts_generator(this, function(_state) {
|
|
19
19
|
switch (_state.label) {
|
|
20
20
|
case 0:
|
|
21
21
|
useConfigContext = param.useConfigContext, useAppContext = param.useAppContext;
|
|
22
|
-
|
|
23
|
-
enableSSR = Boolean(
|
|
22
|
+
modernjsConfig = useConfigContext();
|
|
23
|
+
enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
|
|
24
24
|
return [
|
|
25
25
|
4,
|
|
26
26
|
getMFConfig(userConfig)
|
|
@@ -36,7 +36,7 @@ var moduleFederationPlugin = function() {
|
|
|
36
36
|
2,
|
|
37
37
|
{
|
|
38
38
|
config: function() {
|
|
39
|
-
var
|
|
39
|
+
var _modernjsConfig_dev;
|
|
40
40
|
if (enableSSR) {
|
|
41
41
|
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
|
42
42
|
process.env["MF_SSR_PRJ"] = "true";
|
|
@@ -55,9 +55,10 @@ var moduleFederationPlugin = function() {
|
|
|
55
55
|
(_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(browserPlugin);
|
|
56
56
|
}
|
|
57
57
|
patchWebpackConfig({
|
|
58
|
-
config,
|
|
58
|
+
bundlerConfig: config,
|
|
59
59
|
isServer,
|
|
60
|
-
|
|
60
|
+
modernjsConfig,
|
|
61
|
+
mfConfig: envConfig
|
|
61
62
|
});
|
|
62
63
|
};
|
|
63
64
|
return {
|
|
@@ -67,9 +68,9 @@ var moduleFederationPlugin = function() {
|
|
|
67
68
|
},
|
|
68
69
|
webpack: function webpack(config, param2) {
|
|
69
70
|
var isServer = param2.isServer;
|
|
70
|
-
var
|
|
71
|
+
var _modernjsConfig_source;
|
|
71
72
|
modifyBundlerConfig(config, isServer);
|
|
72
|
-
var enableAsyncEntry = (
|
|
73
|
+
var enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry;
|
|
73
74
|
if (mfConfig.async || !enableAsyncEntry && mfConfig.async !== false) {
|
|
74
75
|
var _config_plugins;
|
|
75
76
|
var asyncBoundaryPluginOptions = typeof mfConfig.async === "object" ? mfConfig.async : {
|
|
@@ -122,7 +123,7 @@ var moduleFederationPlugin = function() {
|
|
|
122
123
|
}
|
|
123
124
|
},
|
|
124
125
|
dev: {
|
|
125
|
-
assetPrefix: (
|
|
126
|
+
assetPrefix: (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.assetPrefix) ? modernjsConfig.dev.assetPrefix : true
|
|
126
127
|
}
|
|
127
128
|
};
|
|
128
129
|
},
|
package/dist/esm/cli/utils.js
CHANGED
|
@@ -73,20 +73,28 @@ function getTargetEnvConfig(mfConfig, isServer) {
|
|
|
73
73
|
return mfConfig;
|
|
74
74
|
}
|
|
75
75
|
function patchWebpackConfig(options) {
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
(
|
|
81
|
-
|
|
82
|
-
config.optimization.splitChunks.chunks = "async";
|
|
76
|
+
var _modernjsConfig_server, _modernjsConfig_server_ssr, _modernjsConfig_server1, _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output;
|
|
77
|
+
var bundlerConfig = options.bundlerConfig, modernjsConfig = options.modernjsConfig, isServer = options.isServer, mfConfig = options.mfConfig;
|
|
78
|
+
var isStreamSSR = typeof (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr) === "object" ? (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server1 = modernjsConfig.server) === null || _modernjsConfig_server1 === void 0 ? void 0 : (_modernjsConfig_server_ssr = _modernjsConfig_server1.ssr) === null || _modernjsConfig_server_ssr === void 0 ? void 0 : _modernjsConfig_server_ssr.mode) === "stream" : false;
|
|
79
|
+
(_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? true : delete _bundlerConfig_optimization.runtimeChunk;
|
|
80
|
+
if (!isServer && isStreamSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
81
|
+
bundlerConfig.optimization.splitChunks.chunks = "async";
|
|
83
82
|
console.warn('[Modern.js Module Federation] splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"');
|
|
84
83
|
}
|
|
85
|
-
if (((
|
|
86
|
-
var
|
|
87
|
-
var port = ((
|
|
84
|
+
if (((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
|
|
85
|
+
var _modernjsConfig_dev, _modernjsConfig_server2;
|
|
86
|
+
var port = ((_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.port) || ((_modernjsConfig_server2 = modernjsConfig.server) === null || _modernjsConfig_server2 === void 0 ? void 0 : _modernjsConfig_server2.port) || 8080;
|
|
88
87
|
var publicPath = "http://localhost:".concat(port, "/");
|
|
89
|
-
|
|
88
|
+
bundlerConfig.output.publicPath = publicPath;
|
|
89
|
+
}
|
|
90
|
+
if (isServer && isStreamSSR) {
|
|
91
|
+
var output = bundlerConfig.output;
|
|
92
|
+
var uniqueName = mfConfig.name || (output === null || output === void 0 ? void 0 : output.uniqueName);
|
|
93
|
+
var chunkFileName = output === null || output === void 0 ? void 0 : output.chunkFilename;
|
|
94
|
+
if (output && typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
95
|
+
var suffix = "-[chunkhash].js";
|
|
96
|
+
output.chunkFilename = chunkFileName.replace(".js", suffix);
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
100
|
export {
|
|
File without changes
|
|
@@ -9,9 +9,9 @@ import { MODERN_JS_SERVER_DIR } from "../constant";
|
|
|
9
9
|
const moduleFederationPlugin = (userConfig = {}) => ({
|
|
10
10
|
name: "@modern-js/plugin-module-federation",
|
|
11
11
|
setup: async ({ useConfigContext, useAppContext }) => {
|
|
12
|
-
var
|
|
13
|
-
const
|
|
14
|
-
const enableSSR = Boolean(
|
|
12
|
+
var _modernjsConfig_server;
|
|
13
|
+
const modernjsConfig = useConfigContext();
|
|
14
|
+
const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
|
|
15
15
|
const mfConfig = await getMFConfig(userConfig);
|
|
16
16
|
let outputDir = "";
|
|
17
17
|
const bundlerType = useAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
|
|
@@ -22,7 +22,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
22
22
|
let nodePlugin;
|
|
23
23
|
return {
|
|
24
24
|
config: () => {
|
|
25
|
-
var
|
|
25
|
+
var _modernjsConfig_dev;
|
|
26
26
|
if (enableSSR) {
|
|
27
27
|
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
|
28
28
|
process.env["MF_SSR_PRJ"] = "true";
|
|
@@ -41,9 +41,10 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
41
41
|
(_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(browserPlugin);
|
|
42
42
|
}
|
|
43
43
|
patchWebpackConfig({
|
|
44
|
-
config,
|
|
44
|
+
bundlerConfig: config,
|
|
45
45
|
isServer,
|
|
46
|
-
|
|
46
|
+
modernjsConfig,
|
|
47
|
+
mfConfig: envConfig
|
|
47
48
|
});
|
|
48
49
|
};
|
|
49
50
|
return {
|
|
@@ -52,9 +53,9 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
52
53
|
modifyBundlerConfig(config, false);
|
|
53
54
|
},
|
|
54
55
|
webpack(config, { isServer }) {
|
|
55
|
-
var
|
|
56
|
+
var _modernjsConfig_source;
|
|
56
57
|
modifyBundlerConfig(config, isServer);
|
|
57
|
-
const enableAsyncEntry = (
|
|
58
|
+
const enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry;
|
|
58
59
|
if (mfConfig.async || !enableAsyncEntry && mfConfig.async !== false) {
|
|
59
60
|
var _config_plugins;
|
|
60
61
|
const asyncBoundaryPluginOptions = typeof mfConfig.async === "object" ? mfConfig.async : {
|
|
@@ -103,7 +104,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
103
104
|
}
|
|
104
105
|
},
|
|
105
106
|
dev: {
|
|
106
|
-
assetPrefix: (
|
|
107
|
+
assetPrefix: (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.assetPrefix) ? modernjsConfig.dev.assetPrefix : true
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
110
|
},
|
|
@@ -45,20 +45,28 @@ function getTargetEnvConfig(mfConfig, isServer) {
|
|
|
45
45
|
return mfConfig;
|
|
46
46
|
}
|
|
47
47
|
function patchWebpackConfig(options) {
|
|
48
|
-
var
|
|
49
|
-
const {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
config.optimization.splitChunks.chunks = "async";
|
|
48
|
+
var _modernjsConfig_server, _modernjsConfig_server_ssr, _modernjsConfig_server1, _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output;
|
|
49
|
+
const { bundlerConfig, modernjsConfig, isServer, mfConfig } = options;
|
|
50
|
+
const isStreamSSR = typeof (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr) === "object" ? (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server1 = modernjsConfig.server) === null || _modernjsConfig_server1 === void 0 ? void 0 : (_modernjsConfig_server_ssr = _modernjsConfig_server1.ssr) === null || _modernjsConfig_server_ssr === void 0 ? void 0 : _modernjsConfig_server_ssr.mode) === "stream" : false;
|
|
51
|
+
(_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? true : delete _bundlerConfig_optimization.runtimeChunk;
|
|
52
|
+
if (!isServer && isStreamSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
53
|
+
bundlerConfig.optimization.splitChunks.chunks = "async";
|
|
55
54
|
console.warn('[Modern.js Module Federation] splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"');
|
|
56
55
|
}
|
|
57
|
-
if (((
|
|
58
|
-
var
|
|
59
|
-
const port = ((
|
|
56
|
+
if (((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
|
|
57
|
+
var _modernjsConfig_dev, _modernjsConfig_server2;
|
|
58
|
+
const port = ((_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.port) || ((_modernjsConfig_server2 = modernjsConfig.server) === null || _modernjsConfig_server2 === void 0 ? void 0 : _modernjsConfig_server2.port) || 8080;
|
|
60
59
|
const publicPath = `http://localhost:${port}/`;
|
|
61
|
-
|
|
60
|
+
bundlerConfig.output.publicPath = publicPath;
|
|
61
|
+
}
|
|
62
|
+
if (isServer && isStreamSSR) {
|
|
63
|
+
const { output } = bundlerConfig;
|
|
64
|
+
const uniqueName = mfConfig.name || (output === null || output === void 0 ? void 0 : output.uniqueName);
|
|
65
|
+
const chunkFileName = output === null || output === void 0 ? void 0 : output.chunkFilename;
|
|
66
|
+
if (output && typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
67
|
+
const suffix = `-[chunkhash].js`;
|
|
68
|
+
output.chunkFilename = chunkFileName.replace(".js", suffix);
|
|
69
|
+
}
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
export {
|
|
File without changes
|
|
@@ -6,7 +6,8 @@ export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleF
|
|
|
6
6
|
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions) => void;
|
|
7
7
|
export declare function getTargetEnvConfig(mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean): moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
8
8
|
export declare function patchWebpackConfig<T>(options: {
|
|
9
|
-
|
|
9
|
+
bundlerConfig: ConfigType<T>;
|
|
10
10
|
isServer: boolean;
|
|
11
|
-
|
|
11
|
+
modernjsConfig: UserConfig<AppTools>;
|
|
12
|
+
mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
12
13
|
}): void;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240519072927",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@swc/helpers": "0.5.3",
|
|
39
39
|
"@modern-js/utils": "^2.49.2",
|
|
40
40
|
"@modern-js/node-bundle-require": "^2.49.2",
|
|
41
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
42
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
43
|
-
"@module-federation/node": "0.0.0-next-
|
|
41
|
+
"@module-federation/sdk": "0.0.0-next-20240519072927",
|
|
42
|
+
"@module-federation/enhanced": "0.0.0-next-20240519072927",
|
|
43
|
+
"@module-federation/node": "0.0.0-next-20240519072927"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@modern-js/app-tools": "^2.49.2",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@modern-js/runtime": "^2.49.2",
|
|
49
49
|
"@modern-js/module-tools": "^2.35.0",
|
|
50
50
|
"@modern-js/tsconfig": "^2.35.0",
|
|
51
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
51
|
+
"@module-federation/manifest": "0.0.0-next-20240519072927"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "modern build"
|