@module-federation/rsbuild-plugin 0.0.0-next-20241104032754 → 0.0.0-next-20241104073605
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/index.cjs.js +19 -25
- package/dist/index.esm.js +20 -26
- package/dist/package.json +4 -4
- package/dist/src/utils/index.d.ts +0 -1
- package/package.json +4 -4
- package/dist/src/logger.d.ts +0 -2
- package/dist/src/utils/constant.d.ts +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10,7 +10,7 @@ function isRegExp(target) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
var name = "@module-federation/rsbuild-plugin";
|
|
13
|
-
var version = "0.
|
|
13
|
+
var version = "0.0.2";
|
|
14
14
|
var description = "Module Federation plugin for Rsbuild";
|
|
15
15
|
var homepage = "https://module-federation.io";
|
|
16
16
|
var bugs = {
|
|
@@ -45,11 +45,11 @@ var dependencies = {
|
|
|
45
45
|
"@module-federation/sdk": "workspace:*"
|
|
46
46
|
};
|
|
47
47
|
var devDependencies = {
|
|
48
|
-
"@rsbuild/core": "
|
|
48
|
+
"@rsbuild/core": "1.x"
|
|
49
49
|
};
|
|
50
50
|
var peerDependencies = {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
51
|
+
"@rsbuild/core": "1.x",
|
|
52
|
+
"@module-federation/enhanced": "workspace:*"
|
|
53
53
|
};
|
|
54
54
|
var engines = {
|
|
55
55
|
node: ">=16.0.0"
|
|
@@ -79,8 +79,6 @@ var pkgJson = {
|
|
|
79
79
|
publishConfig: publishConfig
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
var logger = sdk.createLogger('[ Module Federation Rsbuild Plugin ]');
|
|
83
|
-
|
|
84
82
|
function _array_like_to_array(arr, len) {
|
|
85
83
|
if (len == null || len > arr.length) len = arr.length;
|
|
86
84
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -299,24 +297,14 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
299
297
|
return shared[0].endsWith('/') ? shared[0].slice(0, -1) : shared[0];
|
|
300
298
|
});
|
|
301
299
|
api.modifyRsbuildConfig(function(config) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
300
|
+
var _config_server, _config_dev_client, _config_dev;
|
|
301
|
+
// If this is a provider app, Rsbuild should send the ws request to the provider's dev server.
|
|
302
|
+
// This allows the provider to do HMR when the provider module is loaded in the consumer's page.
|
|
303
|
+
if (moduleFederationOptions.exposes && ((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.port) && !((_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : (_config_dev_client = _config_dev.client) === null || _config_dev_client === void 0 ? void 0 : _config_dev_client.port)) {
|
|
304
|
+
var _config, _config_dev1;
|
|
306
305
|
(_config = config).dev || (_config.dev = {});
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.port) && !((_config_dev_client = config.dev.client) === null || _config_dev_client === void 0 ? void 0 : _config_dev_client.port)) {
|
|
310
|
-
var _config_dev;
|
|
311
|
-
(_config_dev = config.dev).client || (_config_dev.client = {});
|
|
312
|
-
config.dev.client.port = config.server.port;
|
|
313
|
-
}
|
|
314
|
-
// Change the default assetPrefix to `true` for remote modules.
|
|
315
|
-
// This ensures that the remote module's assets can be requested by consumer apps with the correct URL.
|
|
316
|
-
var originalConfig = api.getRsbuildConfig('original');
|
|
317
|
-
if (((_originalConfig_dev = originalConfig.dev) === null || _originalConfig_dev === void 0 ? void 0 : _originalConfig_dev.assetPrefix) === undefined && config.dev.assetPrefix === ((_config_server1 = config.server) === null || _config_server1 === void 0 ? void 0 : _config_server1.base)) {
|
|
318
|
-
config.dev.assetPrefix = true;
|
|
319
|
-
}
|
|
306
|
+
(_config_dev1 = config.dev).client || (_config_dev1.client = {});
|
|
307
|
+
config.dev.client.port = config.server.port;
|
|
320
308
|
}
|
|
321
309
|
});
|
|
322
310
|
api.modifyEnvironmentConfig(function(config, param) {
|
|
@@ -351,7 +339,7 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
351
339
|
return false;
|
|
352
340
|
});
|
|
353
341
|
if (match) {
|
|
354
|
-
|
|
342
|
+
console.log("[Module Federation Rsbuild Plugin]: ".concat(sharedModule, " is removed from externals because it is a shared module."));
|
|
355
343
|
}
|
|
356
344
|
return !match;
|
|
357
345
|
}
|
|
@@ -366,7 +354,7 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
366
354
|
return dep === ext;
|
|
367
355
|
});
|
|
368
356
|
if (match1) {
|
|
369
|
-
|
|
357
|
+
console.log("[Module Federation Rsbuild Plugin]: ".concat(sharedModule, " is removed from externals because it is a shared module."));
|
|
370
358
|
return false;
|
|
371
359
|
}
|
|
372
360
|
return true;
|
|
@@ -387,6 +375,7 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
387
375
|
});
|
|
388
376
|
api.modifyBundlerChain(/*#__PURE__*/ function() {
|
|
389
377
|
var _ref = _async_to_generator(function(chain) {
|
|
378
|
+
var publicPath;
|
|
390
379
|
return _ts_generator(this, function(_state) {
|
|
391
380
|
chain.plugin('module-federation').use(rspack.ModuleFederationPlugin, [
|
|
392
381
|
moduleFederationOptions
|
|
@@ -395,6 +384,11 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
395
384
|
if (!chain.output.get('uniqueName')) {
|
|
396
385
|
chain.output.set('uniqueName', moduleFederationOptions.name);
|
|
397
386
|
}
|
|
387
|
+
publicPath = chain.output.get('publicPath');
|
|
388
|
+
// set the default publicPath to 'auto' to make MF work
|
|
389
|
+
if (publicPath === '/') {
|
|
390
|
+
chain.output.set('publicPath', 'auto');
|
|
391
|
+
}
|
|
398
392
|
return [
|
|
399
393
|
2
|
|
400
394
|
];
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseOptions } from '@module-federation/enhanced';
|
|
2
2
|
import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
3
|
-
import {
|
|
3
|
+
import { isRequiredVersion } from '@module-federation/sdk';
|
|
4
4
|
import util from 'util';
|
|
5
5
|
|
|
6
6
|
function isRegExp(target) {
|
|
@@ -8,7 +8,7 @@ function isRegExp(target) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
var name = "@module-federation/rsbuild-plugin";
|
|
11
|
-
var version = "0.
|
|
11
|
+
var version = "0.0.2";
|
|
12
12
|
var description = "Module Federation plugin for Rsbuild";
|
|
13
13
|
var homepage = "https://module-federation.io";
|
|
14
14
|
var bugs = {
|
|
@@ -43,11 +43,11 @@ var dependencies = {
|
|
|
43
43
|
"@module-federation/sdk": "workspace:*"
|
|
44
44
|
};
|
|
45
45
|
var devDependencies = {
|
|
46
|
-
"@rsbuild/core": "
|
|
46
|
+
"@rsbuild/core": "1.x"
|
|
47
47
|
};
|
|
48
48
|
var peerDependencies = {
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
49
|
+
"@rsbuild/core": "1.x",
|
|
50
|
+
"@module-federation/enhanced": "workspace:*"
|
|
51
51
|
};
|
|
52
52
|
var engines = {
|
|
53
53
|
node: ">=16.0.0"
|
|
@@ -77,8 +77,6 @@ var pkgJson = {
|
|
|
77
77
|
publishConfig: publishConfig
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
var logger = createLogger('[ Module Federation Rsbuild Plugin ]');
|
|
81
|
-
|
|
82
80
|
function _array_like_to_array(arr, len) {
|
|
83
81
|
if (len == null || len > arr.length) len = arr.length;
|
|
84
82
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -297,24 +295,14 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
297
295
|
return shared[0].endsWith('/') ? shared[0].slice(0, -1) : shared[0];
|
|
298
296
|
});
|
|
299
297
|
api.modifyRsbuildConfig(function(config) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
298
|
+
var _config_server, _config_dev_client, _config_dev;
|
|
299
|
+
// If this is a provider app, Rsbuild should send the ws request to the provider's dev server.
|
|
300
|
+
// This allows the provider to do HMR when the provider module is loaded in the consumer's page.
|
|
301
|
+
if (moduleFederationOptions.exposes && ((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.port) && !((_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : (_config_dev_client = _config_dev.client) === null || _config_dev_client === void 0 ? void 0 : _config_dev_client.port)) {
|
|
302
|
+
var _config, _config_dev1;
|
|
304
303
|
(_config = config).dev || (_config.dev = {});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.port) && !((_config_dev_client = config.dev.client) === null || _config_dev_client === void 0 ? void 0 : _config_dev_client.port)) {
|
|
308
|
-
var _config_dev;
|
|
309
|
-
(_config_dev = config.dev).client || (_config_dev.client = {});
|
|
310
|
-
config.dev.client.port = config.server.port;
|
|
311
|
-
}
|
|
312
|
-
// Change the default assetPrefix to `true` for remote modules.
|
|
313
|
-
// This ensures that the remote module's assets can be requested by consumer apps with the correct URL.
|
|
314
|
-
var originalConfig = api.getRsbuildConfig('original');
|
|
315
|
-
if (((_originalConfig_dev = originalConfig.dev) === null || _originalConfig_dev === void 0 ? void 0 : _originalConfig_dev.assetPrefix) === undefined && config.dev.assetPrefix === ((_config_server1 = config.server) === null || _config_server1 === void 0 ? void 0 : _config_server1.base)) {
|
|
316
|
-
config.dev.assetPrefix = true;
|
|
317
|
-
}
|
|
304
|
+
(_config_dev1 = config.dev).client || (_config_dev1.client = {});
|
|
305
|
+
config.dev.client.port = config.server.port;
|
|
318
306
|
}
|
|
319
307
|
});
|
|
320
308
|
api.modifyEnvironmentConfig(function(config, param) {
|
|
@@ -349,7 +337,7 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
349
337
|
return false;
|
|
350
338
|
});
|
|
351
339
|
if (match) {
|
|
352
|
-
|
|
340
|
+
console.log("[Module Federation Rsbuild Plugin]: ".concat(sharedModule, " is removed from externals because it is a shared module."));
|
|
353
341
|
}
|
|
354
342
|
return !match;
|
|
355
343
|
}
|
|
@@ -364,7 +352,7 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
364
352
|
return dep === ext;
|
|
365
353
|
});
|
|
366
354
|
if (match1) {
|
|
367
|
-
|
|
355
|
+
console.log("[Module Federation Rsbuild Plugin]: ".concat(sharedModule, " is removed from externals because it is a shared module."));
|
|
368
356
|
return false;
|
|
369
357
|
}
|
|
370
358
|
return true;
|
|
@@ -385,6 +373,7 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
385
373
|
});
|
|
386
374
|
api.modifyBundlerChain(/*#__PURE__*/ function() {
|
|
387
375
|
var _ref = _async_to_generator(function(chain) {
|
|
376
|
+
var publicPath;
|
|
388
377
|
return _ts_generator(this, function(_state) {
|
|
389
378
|
chain.plugin('module-federation').use(ModuleFederationPlugin, [
|
|
390
379
|
moduleFederationOptions
|
|
@@ -393,6 +382,11 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
393
382
|
if (!chain.output.get('uniqueName')) {
|
|
394
383
|
chain.output.set('uniqueName', moduleFederationOptions.name);
|
|
395
384
|
}
|
|
385
|
+
publicPath = chain.output.get('publicPath');
|
|
386
|
+
// set the default publicPath to 'auto' to make MF work
|
|
387
|
+
if (publicPath === '/') {
|
|
388
|
+
chain.output.set('publicPath', 'auto');
|
|
389
|
+
}
|
|
396
390
|
return [
|
|
397
391
|
2
|
|
398
392
|
];
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/rsbuild-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Module Federation plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://module-federation.io",
|
|
6
6
|
"bugs": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@module-federation/sdk": "workspace:*"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@rsbuild/core": "
|
|
38
|
+
"@rsbuild/core": "1.x"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
41
|
+
"@rsbuild/core": "1.x",
|
|
42
|
+
"@module-federation/enhanced": "workspace:*"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=16.0.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/rsbuild-plugin",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20241104073605",
|
|
4
4
|
"description": "Module Federation plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://module-federation.io",
|
|
6
6
|
"bugs": {
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
35
|
+
"@module-federation/sdk": "0.0.0-next-20241104073605"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@rsbuild/core": "
|
|
38
|
+
"@rsbuild/core": "1.x"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@rsbuild/core": "1.x",
|
|
42
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
42
|
+
"@module-federation/enhanced": "0.0.0-next-20241104073605"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=16.0.0"
|
package/dist/src/logger.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_ASSET_PREFIX = "/";
|