@module-federation/modern-js 2.5.0 → 2.6.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.
|
@@ -72,6 +72,22 @@ function getManifestAssetFileNames(manifestOption) {
|
|
|
72
72
|
manifestFileName: (0, sdk_namespaceObject.simpleJoinRemoteEntry)(filePath, manifestFileName)
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
+
const STATIC_ASSET_MODULE_TYPES = [
|
|
76
|
+
'asset',
|
|
77
|
+
'asset/resource'
|
|
78
|
+
];
|
|
79
|
+
const preserveStaticAssetPublicPath = (config, publicPath)=>{
|
|
80
|
+
var _config, _moduleConfig;
|
|
81
|
+
if ('string' != typeof publicPath || '' === publicPath || 'auto' === publicPath) return;
|
|
82
|
+
(_config = config).module || (_config.module = {});
|
|
83
|
+
const moduleConfig = config.module;
|
|
84
|
+
(_moduleConfig = moduleConfig).generator || (_moduleConfig.generator = {});
|
|
85
|
+
for (const moduleType of STATIC_ASSET_MODULE_TYPES){
|
|
86
|
+
var _moduleConfig_generator, _moduleType, _moduleConfig_generator_moduleType;
|
|
87
|
+
(_moduleConfig_generator = moduleConfig.generator)[_moduleType = moduleType] || (_moduleConfig_generator[_moduleType] = {});
|
|
88
|
+
null != (_moduleConfig_generator_moduleType = moduleConfig.generator[moduleType]).publicPath || (_moduleConfig_generator_moduleType.publicPath = publicPath);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
75
91
|
const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
76
92
|
name: '@modern-js/plugin-mf-post-config',
|
|
77
93
|
pre: [
|
|
@@ -127,7 +143,9 @@ const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
|
127
143
|
if (ssrEnv !== utils.environment.name) return config;
|
|
128
144
|
const userSSRConfig = pluginOptions.userConfig.ssr ? 'object' == typeof pluginOptions.userConfig.ssr ? pluginOptions.userConfig.ssr : {} : {};
|
|
129
145
|
if (!userSSRConfig.distOutputDir) return;
|
|
130
|
-
|
|
146
|
+
const publicPath = config.output.publicPath;
|
|
147
|
+
preserveStaticAssetPublicPath(config, publicPath);
|
|
148
|
+
config.output.publicPath = `${publicPath}${external_path_default().relative(csrOutputPath, ssrOutputPath)}/`;
|
|
131
149
|
return config;
|
|
132
150
|
};
|
|
133
151
|
api.modifyWebpackConfig((config, utils)=>{
|
|
@@ -36,6 +36,35 @@ function getManifestAssetFileNames(manifestOption) {
|
|
|
36
36
|
manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName)
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
+
var STATIC_ASSET_MODULE_TYPES = [
|
|
40
|
+
'asset',
|
|
41
|
+
'asset/resource'
|
|
42
|
+
];
|
|
43
|
+
var ssrPlugin_preserveStaticAssetPublicPath = function(config, publicPath) {
|
|
44
|
+
var _config, _moduleConfig;
|
|
45
|
+
if ('string' != typeof publicPath || '' === publicPath || 'auto' === publicPath) return;
|
|
46
|
+
(_config = config).module || (_config.module = {});
|
|
47
|
+
var moduleConfig = config.module;
|
|
48
|
+
(_moduleConfig = moduleConfig).generator || (_moduleConfig.generator = {});
|
|
49
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
50
|
+
try {
|
|
51
|
+
for(var _iterator = STATIC_ASSET_MODULE_TYPES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
52
|
+
var moduleType = _step.value;
|
|
53
|
+
var _moduleConfig_generator, _moduleType, _moduleConfig_generator_moduleType;
|
|
54
|
+
(_moduleConfig_generator = moduleConfig.generator)[_moduleType = moduleType] || (_moduleConfig_generator[_moduleType] = {});
|
|
55
|
+
null != (_moduleConfig_generator_moduleType = moduleConfig.generator[moduleType]).publicPath || (_moduleConfig_generator_moduleType.publicPath = publicPath);
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_didIteratorError = true;
|
|
59
|
+
_iteratorError = err;
|
|
60
|
+
} finally{
|
|
61
|
+
try {
|
|
62
|
+
if (!_iteratorNormalCompletion && null != _iterator.return) _iterator.return();
|
|
63
|
+
} finally{
|
|
64
|
+
if (_didIteratorError) throw _iteratorError;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
39
68
|
var ssrPlugin_mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
40
69
|
return {
|
|
41
70
|
name: '@modern-js/plugin-mf-post-config',
|
|
@@ -93,7 +122,9 @@ var ssrPlugin_mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
|
93
122
|
if (ssrEnv !== utils.environment.name) return config;
|
|
94
123
|
var userSSRConfig = pluginOptions.userConfig.ssr ? 'object' === _type_of__(pluginOptions.userConfig.ssr) ? pluginOptions.userConfig.ssr : {} : {};
|
|
95
124
|
if (!userSSRConfig.distOutputDir) return;
|
|
96
|
-
|
|
125
|
+
var publicPath = config.output.publicPath;
|
|
126
|
+
ssrPlugin_preserveStaticAssetPublicPath(config, publicPath);
|
|
127
|
+
config.output.publicPath = "".concat(publicPath).concat(path.relative(csrOutputPath, ssrOutputPath), "/");
|
|
97
128
|
return config;
|
|
98
129
|
};
|
|
99
130
|
api.modifyWebpackConfig(function(config, utils) {
|
|
@@ -28,6 +28,22 @@ function getManifestAssetFileNames(manifestOption) {
|
|
|
28
28
|
manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName)
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
+
const STATIC_ASSET_MODULE_TYPES = [
|
|
32
|
+
'asset',
|
|
33
|
+
'asset/resource'
|
|
34
|
+
];
|
|
35
|
+
const preserveStaticAssetPublicPath = (config, publicPath)=>{
|
|
36
|
+
var _config, _moduleConfig;
|
|
37
|
+
if ('string' != typeof publicPath || '' === publicPath || 'auto' === publicPath) return;
|
|
38
|
+
(_config = config).module || (_config.module = {});
|
|
39
|
+
const moduleConfig = config.module;
|
|
40
|
+
(_moduleConfig = moduleConfig).generator || (_moduleConfig.generator = {});
|
|
41
|
+
for (const moduleType of STATIC_ASSET_MODULE_TYPES){
|
|
42
|
+
var _moduleConfig_generator, _moduleType, _moduleConfig_generator_moduleType;
|
|
43
|
+
(_moduleConfig_generator = moduleConfig.generator)[_moduleType = moduleType] || (_moduleConfig_generator[_moduleType] = {});
|
|
44
|
+
null != (_moduleConfig_generator_moduleType = moduleConfig.generator[moduleType]).publicPath || (_moduleConfig_generator_moduleType.publicPath = publicPath);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
31
47
|
const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
32
48
|
name: '@modern-js/plugin-mf-post-config',
|
|
33
49
|
pre: [
|
|
@@ -83,7 +99,9 @@ const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
|
83
99
|
if (ssrEnv !== utils.environment.name) return config;
|
|
84
100
|
const userSSRConfig = pluginOptions.userConfig.ssr ? 'object' == typeof pluginOptions.userConfig.ssr ? pluginOptions.userConfig.ssr : {} : {};
|
|
85
101
|
if (!userSSRConfig.distOutputDir) return;
|
|
86
|
-
|
|
102
|
+
const publicPath = config.output.publicPath;
|
|
103
|
+
preserveStaticAssetPublicPath(config, publicPath);
|
|
104
|
+
config.output.publicPath = `${publicPath}${path.relative(csrOutputPath, ssrOutputPath)}/`;
|
|
87
105
|
return config;
|
|
88
106
|
};
|
|
89
107
|
api.modifyWebpackConfig((config, utils)=>{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -138,13 +138,13 @@
|
|
|
138
138
|
"node-fetch": "3.3.0",
|
|
139
139
|
"jiti": "2.4.2",
|
|
140
140
|
"react-error-boundary": "4.1.2",
|
|
141
|
-
"@module-federation/
|
|
142
|
-
"@module-federation/
|
|
143
|
-
"@module-federation/
|
|
144
|
-
"@module-federation/
|
|
145
|
-
"@module-federation/cli": "2.
|
|
146
|
-
"@module-federation/
|
|
147
|
-
"@module-federation/
|
|
141
|
+
"@module-federation/rsbuild-plugin": "2.6.0",
|
|
142
|
+
"@module-federation/bridge-react": "2.6.0",
|
|
143
|
+
"@module-federation/node": "2.7.45",
|
|
144
|
+
"@module-federation/sdk": "2.6.0",
|
|
145
|
+
"@module-federation/cli": "2.6.0",
|
|
146
|
+
"@module-federation/runtime": "2.6.0",
|
|
147
|
+
"@module-federation/enhanced": "2.6.0"
|
|
148
148
|
},
|
|
149
149
|
"devDependencies": {
|
|
150
150
|
"@rsbuild/plugin-react": "1.4.5",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"@types/react": "^18.3.11",
|
|
159
159
|
"@types/react-dom": "^18.3.0",
|
|
160
160
|
"vitest": "1.6.0",
|
|
161
|
-
"@module-federation/manifest": "2.
|
|
161
|
+
"@module-federation/manifest": "2.6.0"
|
|
162
162
|
},
|
|
163
163
|
"peerDependencies": {
|
|
164
164
|
"react": ">=17",
|