@module-federation/vite 1.0.0-alpha-0b760f6 → 1.1.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.
- package/README.md +88 -48
- package/lib/index.cjs +134 -150
- package/lib/index.esm.js +134 -150
- package/lib/index.modern.js +148 -164
- package/lib/index.umd.js +134 -150
- package/lib/plugins/pluginDevProxyModuleTopLevelAwait.d.ts +1 -1
- package/lib/plugins/pluginModuleParseEnd.d.ts +1 -1
- package/lib/plugins/pluginProxyRemotes.d.ts +2 -2
- package/lib/utils/__tests__/normalizeModuleFederationOption.test.d.ts +1 -0
- package/lib/utils/logUtils.d.ts +1 -0
- package/lib/utils/normalizeModuleFederationOptions.d.ts +47 -32
- package/lib/virtualModules/index.d.ts +5 -4
- package/lib/virtualModules/virtualExposes.d.ts +2 -0
- package/lib/virtualModules/virtualRuntimeInitStatus.d.ts +1 -1
- package/lib/virtualModules/virtualShared_preBuild.d.ts +5 -5
- package/package.json +11 -4
package/lib/index.umd.js
CHANGED
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
var entryName = _ref.entryName,
|
|
33
33
|
entryPath = _ref.entryPath,
|
|
34
34
|
fileName = _ref.fileName;
|
|
35
|
-
var devEntryPath = entryPath.startsWith(
|
|
35
|
+
var devEntryPath = entryPath.startsWith('virtual:mf') ? '/@id/' + entryPath : entryPath;
|
|
36
36
|
var entryFiles = [];
|
|
37
37
|
var htmlFilePath;
|
|
38
38
|
var _command;
|
|
39
39
|
return [{
|
|
40
40
|
name: 'add-entry',
|
|
41
|
-
apply:
|
|
41
|
+
apply: 'serve',
|
|
42
42
|
config: function config(_config, _ref2) {
|
|
43
43
|
var command = _ref2.command;
|
|
44
44
|
_command = command;
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
return c.replace('<head>', "<head><script type=\"module\" src=" + JSON.stringify(devEntryPath.replace(/.+?\:([/\\])[/\\]?/, '$1').replace(/\\\\?/g, '/')) + "></script>");
|
|
65
65
|
}
|
|
66
66
|
}, {
|
|
67
|
-
name:
|
|
68
|
-
enforce:
|
|
67
|
+
name: 'add-entry',
|
|
68
|
+
enforce: 'post',
|
|
69
69
|
configResolved: function configResolved(config) {
|
|
70
70
|
var inputOptions = config.build.rollupOptions.input;
|
|
71
71
|
if (!inputOptions) {
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
buildStart: function buildStart() {
|
|
85
|
-
if (_command ===
|
|
86
|
-
var hasHash = fileName == null || fileName.includes == null ? void 0 : fileName.includes(
|
|
85
|
+
if (_command === 'serve') return;
|
|
86
|
+
var hasHash = fileName == null || fileName.includes == null ? void 0 : fileName.includes('[hash');
|
|
87
87
|
var emitFileOptions = {
|
|
88
88
|
name: entryName,
|
|
89
89
|
type: 'chunk',
|
|
@@ -120,10 +120,10 @@
|
|
|
120
120
|
function PluginDevProxyModuleTopLevelAwait() {
|
|
121
121
|
var filterFunction = pluginutils.createFilter();
|
|
122
122
|
return {
|
|
123
|
-
name:
|
|
124
|
-
apply:
|
|
123
|
+
name: 'dev-proxy-module-top-level-await',
|
|
124
|
+
apply: 'serve',
|
|
125
125
|
transform: function transform(code, id) {
|
|
126
|
-
if (!code.includes(
|
|
126
|
+
if (!code.includes('/*mf top-level-await placeholder replacement mf*/')) {
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
129
|
if (!filterFunction(id)) return null;
|
|
@@ -207,6 +207,15 @@
|
|
|
207
207
|
}
|
|
208
208
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
209
209
|
}
|
|
210
|
+
function _extends() {
|
|
211
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
212
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
213
|
+
var t = arguments[e];
|
|
214
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
215
|
+
}
|
|
216
|
+
return n;
|
|
217
|
+
}, _extends.apply(null, arguments);
|
|
218
|
+
}
|
|
210
219
|
function _unsupportedIterableToArray(r, a) {
|
|
211
220
|
if (r) {
|
|
212
221
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -215,6 +224,12 @@
|
|
|
215
224
|
}
|
|
216
225
|
}
|
|
217
226
|
|
|
227
|
+
var warn = function warn(message) {
|
|
228
|
+
return message.split('\n').forEach(function (msg) {
|
|
229
|
+
return console.warn('\x1b[33m%s\x1b[0m', msg);
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
218
233
|
function normalizeExposesItem(key, item) {
|
|
219
234
|
var importPath = '';
|
|
220
235
|
if (typeof item === 'string') {
|
|
@@ -288,7 +303,7 @@
|
|
|
288
303
|
from: '',
|
|
289
304
|
shareConfig: {
|
|
290
305
|
singleton: false,
|
|
291
|
-
requiredVersion: "^" + version
|
|
306
|
+
requiredVersion: version ? "^" + version : '*'
|
|
292
307
|
}
|
|
293
308
|
};
|
|
294
309
|
}
|
|
@@ -299,7 +314,7 @@
|
|
|
299
314
|
scope: shareItem.shareScope || 'default',
|
|
300
315
|
shareConfig: {
|
|
301
316
|
singleton: shareItem.singleton || false,
|
|
302
|
-
requiredVersion: shareItem.requiredVersion || "^" + version
|
|
317
|
+
requiredVersion: shareItem.requiredVersion || (version ? "^" + version : '*'),
|
|
303
318
|
strictVersion: !!shareItem.strictVersion
|
|
304
319
|
}
|
|
305
320
|
};
|
|
@@ -328,13 +343,13 @@
|
|
|
328
343
|
if (manifest === void 0) {
|
|
329
344
|
manifest = false;
|
|
330
345
|
}
|
|
331
|
-
if (typeof manifest ===
|
|
346
|
+
if (typeof manifest === 'boolean') {
|
|
332
347
|
return manifest;
|
|
333
348
|
}
|
|
334
349
|
return Object.assign({
|
|
335
|
-
filePath:
|
|
350
|
+
filePath: '',
|
|
336
351
|
disableAssetsAnalyze: false,
|
|
337
|
-
fileName:
|
|
352
|
+
fileName: 'mf-manifest.json'
|
|
338
353
|
}, manifest);
|
|
339
354
|
}
|
|
340
355
|
var config;
|
|
@@ -343,10 +358,13 @@
|
|
|
343
358
|
}
|
|
344
359
|
function getNormalizeShareItem(key) {
|
|
345
360
|
var options = getNormalizeModuleFederationOptions();
|
|
346
|
-
var shareItem = options.shared[removePathFromNpmPackage(key)] || options.shared[removePathFromNpmPackage(key) +
|
|
361
|
+
var shareItem = options.shared[removePathFromNpmPackage(key)] || options.shared[removePathFromNpmPackage(key) + '/'];
|
|
347
362
|
return shareItem;
|
|
348
363
|
}
|
|
349
364
|
function normalizeModuleFederationOptions(options) {
|
|
365
|
+
if (options.getPublicPath || options.publicPath) {
|
|
366
|
+
warn("We are ignoring the getPublicPath and publicPath options because they are natively supported by Vite\nwith the \"experimental.renderBuiltUrl\" configuration https://vitejs.dev/guide/build#advanced-base-options");
|
|
367
|
+
}
|
|
350
368
|
return config = {
|
|
351
369
|
exposes: normalizeExposes(options.exposes),
|
|
352
370
|
filename: options.filename || 'remoteEntry-[hash]',
|
|
@@ -358,11 +376,11 @@
|
|
|
358
376
|
shareScope: options.shareScope || 'default',
|
|
359
377
|
shared: normalizeShared(options.shared),
|
|
360
378
|
runtimePlugins: options.runtimePlugins || [],
|
|
361
|
-
getPublicPath: options.getPublicPath,
|
|
362
379
|
implementation: options.implementation,
|
|
363
380
|
manifest: normalizeManifest(options.manifest),
|
|
364
381
|
dev: options.dev,
|
|
365
|
-
dts: options.dts
|
|
382
|
+
dts: options.dts,
|
|
383
|
+
shareStrategy: options.shareStrategy
|
|
366
384
|
};
|
|
367
385
|
}
|
|
368
386
|
|
|
@@ -380,8 +398,8 @@
|
|
|
380
398
|
* @returns {string} - The encoded file name.
|
|
381
399
|
*/
|
|
382
400
|
function packageNameEncode(name) {
|
|
383
|
-
if (typeof name !==
|
|
384
|
-
return name.replace(/@/g,
|
|
401
|
+
if (typeof name !== 'string') throw new Error('A string package name is required');
|
|
402
|
+
return name.replace(/@/g, '_mf_0_').replace(/\//g, '_mf_1_').replace(/-/g, '_mf_2_').replace(/\./g, '_mf_3_');
|
|
385
403
|
}
|
|
386
404
|
/**
|
|
387
405
|
* Decodes an encoded file name back to the original package name.
|
|
@@ -389,8 +407,8 @@
|
|
|
389
407
|
* @returns {string} - The decoded package name.
|
|
390
408
|
*/
|
|
391
409
|
function packageNameDecode(encoded) {
|
|
392
|
-
if (typeof encoded !==
|
|
393
|
-
return encoded.replace(/_mf_0_/g,
|
|
410
|
+
if (typeof encoded !== 'string') throw new Error('A string encoded file name is required');
|
|
411
|
+
return encoded.replace(/_mf_0_/g, '@').replace(/_mf_1_/g, '/').replace(/_mf_2_/g, '-').replace(/_mf_3_/g, '.');
|
|
394
412
|
}
|
|
395
413
|
|
|
396
414
|
/**
|
|
@@ -399,11 +417,11 @@
|
|
|
399
417
|
function getLocalSharedImportMapPath_temp() {
|
|
400
418
|
var _getNormalizeModuleFe = getNormalizeModuleFederationOptions(),
|
|
401
419
|
name = _getNormalizeModuleFe.name;
|
|
402
|
-
return path__default["default"].resolve(
|
|
420
|
+
return path__default["default"].resolve('.__mf__temp', packageNameEncode(name), 'localSharedImportMap');
|
|
403
421
|
}
|
|
404
422
|
function writeLocalSharedImportMap_temp(content) {
|
|
405
423
|
var localSharedImportMapId = getLocalSharedImportMapPath_temp();
|
|
406
|
-
createFile(localSharedImportMapId +
|
|
424
|
+
createFile(localSharedImportMapId + '.js', '\n// Windows temporarily needs this file, https://github.com/module-federation/vite/issues/68\n' + content);
|
|
407
425
|
}
|
|
408
426
|
function createFile(filePath, content) {
|
|
409
427
|
var dir = path__default["default"].dirname(filePath);
|
|
@@ -425,16 +443,16 @@
|
|
|
425
443
|
}
|
|
426
444
|
currentDir = path.dirname(currentDir);
|
|
427
445
|
}
|
|
428
|
-
return
|
|
446
|
+
return '';
|
|
429
447
|
}();
|
|
430
|
-
var virtualPackageName =
|
|
448
|
+
var virtualPackageName = '__mf__virtual';
|
|
431
449
|
if (!fs.existsSync(path.resolve(nodeModulesDir, virtualPackageName))) {
|
|
432
450
|
fs.mkdirSync(path.resolve(nodeModulesDir, virtualPackageName));
|
|
433
451
|
}
|
|
434
|
-
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName,
|
|
435
|
-
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName,
|
|
452
|
+
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName, 'empty.js'), '');
|
|
453
|
+
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName, 'package.json'), JSON.stringify({
|
|
436
454
|
name: virtualPackageName,
|
|
437
|
-
main:
|
|
455
|
+
main: 'empty.js'
|
|
438
456
|
}));
|
|
439
457
|
var patternMap = {};
|
|
440
458
|
var cacheMap = {};
|
|
@@ -448,7 +466,7 @@
|
|
|
448
466
|
tag = '__mf_v__';
|
|
449
467
|
}
|
|
450
468
|
if (suffix === void 0) {
|
|
451
|
-
suffix =
|
|
469
|
+
suffix = '';
|
|
452
470
|
}
|
|
453
471
|
this.name = void 0;
|
|
454
472
|
this.tag = void 0;
|
|
@@ -456,13 +474,13 @@
|
|
|
456
474
|
this.inited = false;
|
|
457
475
|
this.name = name;
|
|
458
476
|
this.tag = tag;
|
|
459
|
-
this.suffix = suffix || ((_name$split$slice$pop = name.split(
|
|
477
|
+
this.suffix = suffix || ((_name$split$slice$pop = name.split('.').slice(1).pop()) == null ? void 0 : _name$split$slice$pop.replace(/(.)/, '.$1')) || '.js';
|
|
460
478
|
if (!cacheMap[this.tag]) cacheMap[this.tag] = {};
|
|
461
479
|
cacheMap[this.tag][this.name] = this;
|
|
462
480
|
}
|
|
463
481
|
VirtualModule.findModule = function findModule(tag, str) {
|
|
464
482
|
if (str === void 0) {
|
|
465
|
-
str =
|
|
483
|
+
str = '';
|
|
466
484
|
}
|
|
467
485
|
if (!patternMap[tag]) patternMap[tag] = new RegExp("(.*" + packageNameEncode(tag) + "(.+?)" + packageNameEncode(tag) + ".*)");
|
|
468
486
|
var moduleName = (str.match(patternMap[tag]) || [])[2];
|
|
@@ -491,7 +509,15 @@
|
|
|
491
509
|
return VirtualModule;
|
|
492
510
|
}();
|
|
493
511
|
|
|
494
|
-
var
|
|
512
|
+
var VIRTUAL_EXPOSES = 'virtual:mf-exposes';
|
|
513
|
+
function generateExposes() {
|
|
514
|
+
var options = getNormalizeModuleFederationOptions();
|
|
515
|
+
return "\n export default {\n " + Object.keys(options.exposes).map(function (key) {
|
|
516
|
+
return "\n " + JSON.stringify(key) + ": async () => {\n const importModule = await import(" + JSON.stringify(options.exposes[key]["import"]) + ")\n const exportModule = {}\n Object.assign(exportModule, importModule)\n Object.defineProperty(exportModule, \"__esModule\", {\n value: true,\n enumerable: false\n })\n return exportModule\n }\n ";
|
|
517
|
+
}).join(',') + "\n }\n ";
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
var virtualRuntimeInitStatus = new VirtualModule('runtimeInit');
|
|
495
521
|
function writeRuntimeInitStatus() {
|
|
496
522
|
virtualRuntimeInitStatus.writeSync("\n let initResolve, initReject\n const initPromise = new Promise((re, rj) => {\n initResolve = re\n initReject = rj\n })\n export {\n initPromise,\n initResolve,\n initReject\n }\n ");
|
|
497
523
|
}
|
|
@@ -500,7 +526,7 @@
|
|
|
500
526
|
var LOAD_REMOTE_TAG = '__loadRemote__';
|
|
501
527
|
function getRemoteVirtualModule(remote, command) {
|
|
502
528
|
if (!cacheRemoteMap[remote]) {
|
|
503
|
-
cacheRemoteMap[remote] = new VirtualModule(remote, LOAD_REMOTE_TAG,
|
|
529
|
+
cacheRemoteMap[remote] = new VirtualModule(remote, LOAD_REMOTE_TAG, '.js');
|
|
504
530
|
cacheRemoteMap[remote].writeSync(generateRemotes(remote, command));
|
|
505
531
|
}
|
|
506
532
|
var virtual = cacheRemoteMap[remote];
|
|
@@ -517,7 +543,7 @@
|
|
|
517
543
|
return usedRemotesMap;
|
|
518
544
|
}
|
|
519
545
|
function generateRemotes(id, command) {
|
|
520
|
-
return "\n const {loadRemote} = require(\"@module-federation/runtime\")\n const {initPromise} = require(\"" + virtualRuntimeInitStatus.getImportId() + "\")\n const res = initPromise.then(_ => loadRemote(" + JSON.stringify(id) + "))\n const exportModule = " + (command !==
|
|
546
|
+
return "\n const {loadRemote} = require(\"@module-federation/runtime\")\n const {initPromise} = require(\"" + virtualRuntimeInitStatus.getImportId() + "\")\n const res = initPromise.then(_ => loadRemote(" + JSON.stringify(id) + "))\n const exportModule = " + (command !== 'build' ? '/*mf top-level-await placeholder replacement mf*/' : 'await ') + "initPromise.then(_ => res)\n module.exports = exportModule\n ";
|
|
521
547
|
}
|
|
522
548
|
|
|
523
549
|
/**
|
|
@@ -527,10 +553,10 @@
|
|
|
527
553
|
*/
|
|
528
554
|
// *** __prebuild__
|
|
529
555
|
var preBuildCacheMap = {};
|
|
530
|
-
var PREBUILD_TAG =
|
|
556
|
+
var PREBUILD_TAG = '__prebuild__';
|
|
531
557
|
function writePreBuildLibPath(pkg) {
|
|
532
558
|
if (!preBuildCacheMap[pkg]) preBuildCacheMap[pkg] = new VirtualModule(pkg, PREBUILD_TAG);
|
|
533
|
-
preBuildCacheMap[pkg].writeSync(
|
|
559
|
+
preBuildCacheMap[pkg].writeSync('');
|
|
534
560
|
}
|
|
535
561
|
function getPreBuildLibImportId(pkg) {
|
|
536
562
|
if (!preBuildCacheMap[pkg]) preBuildCacheMap[pkg] = new VirtualModule(pkg, PREBUILD_TAG);
|
|
@@ -538,15 +564,15 @@
|
|
|
538
564
|
return importId;
|
|
539
565
|
}
|
|
540
566
|
// *** __loadShare__
|
|
541
|
-
var LOAD_SHARE_TAG =
|
|
567
|
+
var LOAD_SHARE_TAG = '__loadShare__';
|
|
542
568
|
var loadShareCacheMap = {};
|
|
543
569
|
function getLoadShareModulePath(pkg) {
|
|
544
|
-
if (!loadShareCacheMap[pkg]) loadShareCacheMap[pkg] = new VirtualModule(pkg, LOAD_SHARE_TAG,
|
|
570
|
+
if (!loadShareCacheMap[pkg]) loadShareCacheMap[pkg] = new VirtualModule(pkg, LOAD_SHARE_TAG, '.js');
|
|
545
571
|
var filepath = loadShareCacheMap[pkg].getPath();
|
|
546
572
|
return filepath;
|
|
547
573
|
}
|
|
548
574
|
function writeLoadShareModule(pkg, shareItem, command) {
|
|
549
|
-
loadShareCacheMap[pkg].writeSync("\n \n ;() => import(" + JSON.stringify(getPreBuildLibImportId(pkg)) + ").catch(() => {});\n // dev uses dynamic import to separate chunks\n " + (command !==
|
|
575
|
+
loadShareCacheMap[pkg].writeSync("\n \n ;() => import(" + JSON.stringify(getPreBuildLibImportId(pkg)) + ").catch(() => {});\n // dev uses dynamic import to separate chunks\n " + (command !== 'build' ? ";() => import(" + JSON.stringify(pkg) + ").catch(() => {});" : '') + "\n const {loadShare} = require(\"@module-federation/runtime\")\n const {initPromise} = require(\"" + virtualRuntimeInitStatus.getImportId() + "\")\n const res = initPromise.then(_ => loadShare(" + JSON.stringify(pkg) + ", {\n customShareInfo: {shareConfig:{\n singleton: " + shareItem.shareConfig.singleton + ",\n strictVersion: " + shareItem.shareConfig.strictVersion + ",\n requiredVersion: " + JSON.stringify(shareItem.shareConfig.requiredVersion) + "\n }}}))\n const exportModule = " + (command !== 'build' ? '/*mf top-level-await placeholder replacement mf*/' : 'await ') + "res.then(factory => factory())\n module.exports = exportModule\n ");
|
|
550
576
|
}
|
|
551
577
|
|
|
552
578
|
var usedShares = new Set();
|
|
@@ -557,7 +583,7 @@
|
|
|
557
583
|
usedShares.add(pkg);
|
|
558
584
|
}
|
|
559
585
|
// *** Expose locally provided shared modules here
|
|
560
|
-
new VirtualModule(
|
|
586
|
+
new VirtualModule('localSharedImportMap');
|
|
561
587
|
function getLocalSharedImportMapPath() {
|
|
562
588
|
return getLocalSharedImportMapPath_temp();
|
|
563
589
|
// return localSharedImportMapModule.getPath()
|
|
@@ -575,7 +601,7 @@
|
|
|
575
601
|
var options = getNormalizeModuleFederationOptions();
|
|
576
602
|
return "\n const importMap = {\n " + Array.from(getUsedShares()).map(function (pkg) {
|
|
577
603
|
return "\n " + JSON.stringify(pkg) + ": async () => {\n let pkg = await import(\"" + getPreBuildLibImportId(pkg) + "\")\n return pkg\n }\n ";
|
|
578
|
-
}).join(
|
|
604
|
+
}).join(',') + "\n }\n const usedShared = {\n " + Array.from(getUsedShares()).map(function (key) {
|
|
579
605
|
var shareItem = getNormalizeShareItem(key);
|
|
580
606
|
return "\n " + JSON.stringify(key) + ": {\n name: " + JSON.stringify(key) + ",\n version: " + JSON.stringify(shareItem.version) + ",\n scope: [" + JSON.stringify(shareItem.scope) + "],\n loaded: false,\n from: " + JSON.stringify(options.name) + ",\n async get () {\n usedShared[" + JSON.stringify(key) + "].loaded = true\n const {" + JSON.stringify(key) + ": pkgDynamicImport} = importMap \n const res = await pkgDynamicImport()\n const exportModule = {...res}\n // All npm packages pre-built by vite will be converted to esm\n Object.defineProperty(exportModule, \"__esModule\", {\n value: true,\n enumerable: false\n })\n return function () {\n return exportModule\n }\n },\n shareConfig: {\n singleton: " + shareItem.shareConfig.singleton + ",\n requiredVersion: " + JSON.stringify(shareItem.shareConfig.requiredVersion) + "\n }\n }\n ";
|
|
581
607
|
}).join(',') + "\n }\n const usedRemotes = [" + Object.keys(getUsedRemotesMap()).map(function (key) {
|
|
@@ -590,17 +616,15 @@
|
|
|
590
616
|
});
|
|
591
617
|
return "\n import {init as runtimeInit, loadRemote} from \"@module-federation/runtime\";\n " + pluginImportNames.map(function (item) {
|
|
592
618
|
return item[1];
|
|
593
|
-
}).join('\n') + "\n\n const
|
|
594
|
-
return "\n " + JSON.stringify(key) + ": async () => {\n const importModule = await import(" + JSON.stringify(options.exposes[key]["import"]) + ")\n const exportModule = {}\n Object.assign(exportModule, importModule)\n Object.defineProperty(exportModule, \"__esModule\", {\n value: true,\n enumerable: false\n })\n return exportModule\n }\n ";
|
|
595
|
-
}).join(',') + "\n }\n import {usedShared, usedRemotes} from \"" + getLocalSharedImportMapPath() + "\"\n import {\n initResolve\n } from \"" + virtualRuntimeInitStatus.getImportId() + "\"\n async function init(shared = {}) {\n const initRes = runtimeInit({\n name: " + JSON.stringify(options.name) + ",\n remotes: usedRemotes,\n shared: usedShared,\n plugins: [" + pluginImportNames.map(function (item) {
|
|
619
|
+
}).join('\n') + "\n import exposesMap from \"" + VIRTUAL_EXPOSES + "\"\n import {usedShared, usedRemotes} from \"" + getLocalSharedImportMapPath() + "\"\n import {\n initResolve\n } from \"" + virtualRuntimeInitStatus.getImportId() + "\"\n async function init(shared = {}) {\n const initRes = runtimeInit({\n name: " + JSON.stringify(options.name) + ",\n remotes: usedRemotes,\n shared: usedShared,\n plugins: [" + pluginImportNames.map(function (item) {
|
|
596
620
|
return item[0] + "()";
|
|
597
|
-
}).join(', ') + "]\n });\n initRes.initShareScopeMap('" + options.shareScope + "', shared);\n initResolve(initRes)\n return initRes\n }\n\n function getExposes(moduleName) {\n if (!(moduleName in exposesMap)) throw new Error(`Module ${moduleName} does not exist in container.`)\n return (exposesMap[moduleName])().then(res => () => res)\n }\n export {\n init,\n getExposes as get\n }\n ";
|
|
621
|
+
}).join(', ') + "],\n " + (options.shareStrategy ? "shareStrategy: " + options.shareStrategy : '') + "\n });\n initRes.initShareScopeMap('" + options.shareScope + "', shared);\n initResolve(initRes)\n return initRes\n }\n\n function getExposes(moduleName) {\n if (!(moduleName in exposesMap)) throw new Error(`Module ${moduleName} does not exist in container.`)\n return (exposesMap[moduleName])().then(res => () => res)\n }\n export {\n init,\n getExposes as get\n }\n ";
|
|
598
622
|
}
|
|
599
623
|
/**
|
|
600
624
|
* Inject entry file, automatically init when used as host,
|
|
601
625
|
* and will not inject remoteEntry
|
|
602
626
|
*/
|
|
603
|
-
var hostAutoInitModule = new VirtualModule(
|
|
627
|
+
var hostAutoInitModule = new VirtualModule('hostAutoInit');
|
|
604
628
|
function writeHostAutoInit() {
|
|
605
629
|
hostAutoInitModule.writeSync("\n import {init} from \"" + REMOTE_ENTRY_ID + "\"\n init()\n ");
|
|
606
630
|
}
|
|
@@ -622,20 +646,19 @@
|
|
|
622
646
|
var name = mfOptions.name,
|
|
623
647
|
filename = mfOptions.filename,
|
|
624
648
|
manifestOptions = mfOptions.manifest;
|
|
625
|
-
var mfManifestName =
|
|
649
|
+
var mfManifestName = '';
|
|
626
650
|
if (manifestOptions === true) {
|
|
627
|
-
mfManifestName =
|
|
651
|
+
mfManifestName = 'mf-manifest.json';
|
|
628
652
|
}
|
|
629
|
-
if (typeof manifestOptions !==
|
|
630
|
-
mfManifestName = path.join((manifestOptions == null ? void 0 : manifestOptions.filePath) ||
|
|
653
|
+
if (typeof manifestOptions !== 'boolean') {
|
|
654
|
+
mfManifestName = path.join((manifestOptions == null ? void 0 : manifestOptions.filePath) || '', (manifestOptions == null ? void 0 : manifestOptions.fileName) || '');
|
|
631
655
|
}
|
|
632
656
|
var extensions;
|
|
633
657
|
var root;
|
|
634
658
|
var remoteEntryFile;
|
|
635
|
-
var publicPath;
|
|
636
659
|
var _command;
|
|
637
660
|
return [{
|
|
638
|
-
name: '
|
|
661
|
+
name: 'module-federation-manifest',
|
|
639
662
|
apply: 'serve',
|
|
640
663
|
configureServer: function configureServer(server) {
|
|
641
664
|
server.middlewares.use(function (req, res, next) {
|
|
@@ -643,10 +666,10 @@
|
|
|
643
666
|
next();
|
|
644
667
|
return;
|
|
645
668
|
}
|
|
646
|
-
if (req.url === mfManifestName.replace(/^\/?/,
|
|
669
|
+
if (req.url === mfManifestName.replace(/^\/?/, '/')) {
|
|
647
670
|
res.setHeader('Content-Type', 'application/json');
|
|
648
671
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
649
|
-
res.end(JSON.stringify({
|
|
672
|
+
res.end(JSON.stringify(_extends({}, generateMFManifest({}), {
|
|
650
673
|
id: name,
|
|
651
674
|
name: name,
|
|
652
675
|
metaData: {
|
|
@@ -671,70 +694,16 @@
|
|
|
671
694
|
name: ''
|
|
672
695
|
},
|
|
673
696
|
globalName: name,
|
|
674
|
-
pluginVersion: '0.2.5'
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
shared: Array.from(getUsedShares()).map(function (shareKey) {
|
|
678
|
-
var shareItem = getNormalizeShareItem(shareKey);
|
|
679
|
-
return {
|
|
680
|
-
id: name + ":" + shareKey,
|
|
681
|
-
name: shareKey,
|
|
682
|
-
version: shareItem.version,
|
|
683
|
-
requiredVersion: shareItem.shareConfig.requiredVersion,
|
|
684
|
-
assets: {
|
|
685
|
-
js: {
|
|
686
|
-
async: [],
|
|
687
|
-
sync: []
|
|
688
|
-
},
|
|
689
|
-
css: {
|
|
690
|
-
async: [],
|
|
691
|
-
sync: []
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
}),
|
|
696
|
-
remotes: function () {
|
|
697
|
-
var remotes = [];
|
|
698
|
-
var usedRemotesMap = getUsedRemotesMap();
|
|
699
|
-
Object.keys(usedRemotesMap).forEach(function (remoteKey) {
|
|
700
|
-
var usedModules = Array.from(usedRemotesMap[remoteKey]);
|
|
701
|
-
usedModules.forEach(function (moduleKey) {
|
|
702
|
-
remotes.push({
|
|
703
|
-
federationContainerName: mfOptions.remotes[remoteKey].entry,
|
|
704
|
-
moduleName: moduleKey.replace(remoteKey, '').replace('/', ''),
|
|
705
|
-
alias: remoteKey,
|
|
706
|
-
entry: '*'
|
|
707
|
-
});
|
|
708
|
-
});
|
|
709
|
-
});
|
|
710
|
-
return remotes;
|
|
711
|
-
}(),
|
|
712
|
-
exposes: Object.keys(mfOptions.exposes).map(function (key) {
|
|
713
|
-
var formatKey = key.replace('./', '');
|
|
714
|
-
return {
|
|
715
|
-
id: name + ':' + formatKey,
|
|
716
|
-
name: formatKey,
|
|
717
|
-
assets: {
|
|
718
|
-
js: {
|
|
719
|
-
async: [],
|
|
720
|
-
sync: []
|
|
721
|
-
},
|
|
722
|
-
css: {
|
|
723
|
-
sync: [],
|
|
724
|
-
async: []
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
path: key
|
|
728
|
-
};
|
|
729
|
-
})
|
|
730
|
-
}));
|
|
697
|
+
pluginVersion: '0.2.5'
|
|
698
|
+
}
|
|
699
|
+
})));
|
|
731
700
|
} else {
|
|
732
701
|
next();
|
|
733
702
|
}
|
|
734
703
|
});
|
|
735
704
|
}
|
|
736
705
|
}, {
|
|
737
|
-
name: '
|
|
706
|
+
name: 'module-federation-manifest',
|
|
738
707
|
enforce: 'post',
|
|
739
708
|
config: function config(_config, _ref) {
|
|
740
709
|
var command = _ref.command;
|
|
@@ -745,10 +714,10 @@
|
|
|
745
714
|
configResolved: function configResolved(config) {
|
|
746
715
|
root = config.root;
|
|
747
716
|
extensions = config.resolve.extensions || ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'];
|
|
748
|
-
|
|
749
|
-
if (_command ===
|
|
717
|
+
config.base ? config.base.replace(/\/?$/, '/') : 'auto';
|
|
718
|
+
if (_command === 'serve') {
|
|
750
719
|
var origin = config.server.origin;
|
|
751
|
-
|
|
720
|
+
origin ? origin.replace(/\/?$/, '/') : 'auto';
|
|
752
721
|
}
|
|
753
722
|
},
|
|
754
723
|
generateBundle: function generateBundle(options, bundle) {
|
|
@@ -790,7 +759,7 @@
|
|
|
790
759
|
var _Object$entries$_i = _Object$entries[_i],
|
|
791
760
|
fileName = _Object$entries$_i[0],
|
|
792
761
|
fileData = _Object$entries$_i[1];
|
|
793
|
-
if (mfOptions.filename.replace(/[\[\]]/g,
|
|
762
|
+
if (mfOptions.filename.replace(/[\[\]]/g, '_') === fileData.name || fileData.name === 'remoteEntry') {
|
|
794
763
|
remoteEntryFile = fileData.fileName;
|
|
795
764
|
}
|
|
796
765
|
if (fileData.type === 'chunk') {
|
|
@@ -802,7 +771,7 @@
|
|
|
802
771
|
// 检查模块是否在 preloadModules 列表中
|
|
803
772
|
for (var _iterator2 = _createForOfIteratorHelperLoose(exposesModules), _step2; !(_step2 = _iterator2()).done;) {
|
|
804
773
|
var preloadModule = _step2.value;
|
|
805
|
-
var formatPreloadModule = preloadModule.replace(
|
|
774
|
+
var formatPreloadModule = preloadModule.replace('./', '');
|
|
806
775
|
if (isModuleMatched(relativeModulePath, formatPreloadModule)) {
|
|
807
776
|
var _filesContainingModul;
|
|
808
777
|
if (!filesContainingModules[preloadModule]) {
|
|
@@ -821,12 +790,11 @@
|
|
|
821
790
|
}
|
|
822
791
|
}
|
|
823
792
|
}
|
|
824
|
-
;
|
|
825
793
|
var fileToShareKey = {};
|
|
826
794
|
return Promise.resolve(Promise.all(Array.from(getUsedShares()).map(function (shareKey) {
|
|
827
795
|
try {
|
|
828
796
|
return Promise.resolve(_this.resolve(getPreBuildLibImportId(shareKey))).then(function (_this$resolve) {
|
|
829
|
-
var file = _this$resolve.id.split(
|
|
797
|
+
var file = _this$resolve.id.split('?')[0];
|
|
830
798
|
fileToShareKey[file] = shareKey;
|
|
831
799
|
});
|
|
832
800
|
} catch (e) {
|
|
@@ -866,7 +834,7 @@
|
|
|
866
834
|
_this.emitFile({
|
|
867
835
|
type: 'asset',
|
|
868
836
|
fileName: mfManifestName,
|
|
869
|
-
source: generateMFManifest(filesContainingModules)
|
|
837
|
+
source: JSON.stringify(generateMFManifest(filesContainingModules))
|
|
870
838
|
});
|
|
871
839
|
});
|
|
872
840
|
} catch (e) {
|
|
@@ -897,8 +865,7 @@
|
|
|
897
865
|
});
|
|
898
866
|
// @ts-ignore
|
|
899
867
|
var shared = Array.from(getUsedShares()).map(function (shareKey) {
|
|
900
|
-
|
|
901
|
-
if (!preloadMap[shareKey]) return;
|
|
868
|
+
var _preloadMap$shareKey, _preloadMap$shareKey2;
|
|
902
869
|
var shareItem = getNormalizeShareItem(shareKey);
|
|
903
870
|
return {
|
|
904
871
|
id: name + ":" + shareKey,
|
|
@@ -907,8 +874,8 @@
|
|
|
907
874
|
requiredVersion: shareItem.shareConfig.requiredVersion,
|
|
908
875
|
assets: {
|
|
909
876
|
js: {
|
|
910
|
-
async: preloadMap[shareKey].async,
|
|
911
|
-
sync: preloadMap[shareKey].sync
|
|
877
|
+
async: (preloadMap == null || (_preloadMap$shareKey = preloadMap[shareKey]) == null ? void 0 : _preloadMap$shareKey.async) || [],
|
|
878
|
+
sync: (preloadMap == null || (_preloadMap$shareKey2 = preloadMap[shareKey]) == null ? void 0 : _preloadMap$shareKey2.sync) || []
|
|
912
879
|
},
|
|
913
880
|
css: {
|
|
914
881
|
async: [],
|
|
@@ -920,17 +887,17 @@
|
|
|
920
887
|
return item;
|
|
921
888
|
});
|
|
922
889
|
var exposes = Object.keys(options.exposes).map(function (key) {
|
|
890
|
+
var _preloadMap$sourceFil, _preloadMap$sourceFil2;
|
|
923
891
|
// assets(.css, .jpg, .svg等)其他资源, 不重要, 暂未处理
|
|
924
892
|
var formatKey = key.replace('./', '');
|
|
925
893
|
var sourceFile = options.exposes[key]["import"];
|
|
926
|
-
if (!preloadMap[sourceFile]) return;
|
|
927
894
|
return {
|
|
928
895
|
id: name + ':' + formatKey,
|
|
929
896
|
name: formatKey,
|
|
930
897
|
assets: {
|
|
931
898
|
js: {
|
|
932
|
-
async: preloadMap[sourceFile].async,
|
|
933
|
-
sync: preloadMap[sourceFile].sync
|
|
899
|
+
async: (preloadMap == null || (_preloadMap$sourceFil = preloadMap[sourceFile]) == null ? void 0 : _preloadMap$sourceFil.async) || [],
|
|
900
|
+
sync: (preloadMap == null || (_preloadMap$sourceFil2 = preloadMap[sourceFile]) == null ? void 0 : _preloadMap$sourceFil2.sync) || []
|
|
934
901
|
},
|
|
935
902
|
css: {
|
|
936
903
|
sync: [],
|
|
@@ -961,14 +928,13 @@
|
|
|
961
928
|
// "api": "@mf-types.d.ts"
|
|
962
929
|
},
|
|
963
930
|
globalName: name,
|
|
964
|
-
pluginVersion: '0.2.5'
|
|
965
|
-
publicPath: publicPath
|
|
931
|
+
pluginVersion: '0.2.5'
|
|
966
932
|
},
|
|
967
933
|
shared: shared,
|
|
968
934
|
remotes: remotes,
|
|
969
935
|
exposes: exposes
|
|
970
936
|
};
|
|
971
|
-
return
|
|
937
|
+
return result;
|
|
972
938
|
}
|
|
973
939
|
};
|
|
974
940
|
|
|
@@ -977,20 +943,21 @@
|
|
|
977
943
|
_resolve = resolve;
|
|
978
944
|
});
|
|
979
945
|
var parsePromise = promise;
|
|
946
|
+
var exposesParseEnd = false;
|
|
980
947
|
var parseStartSet = new Set();
|
|
981
948
|
var parseEndSet = new Set();
|
|
982
949
|
function pluginModuleParseEnd (excludeFn) {
|
|
983
950
|
return [{
|
|
984
|
-
name:
|
|
985
|
-
apply:
|
|
951
|
+
name: '_',
|
|
952
|
+
apply: 'serve',
|
|
986
953
|
config: function config() {
|
|
987
954
|
// No waiting in development mode
|
|
988
955
|
_resolve(1);
|
|
989
956
|
}
|
|
990
957
|
}, {
|
|
991
|
-
enforce:
|
|
992
|
-
name:
|
|
993
|
-
apply:
|
|
958
|
+
enforce: 'pre',
|
|
959
|
+
name: 'parseStart',
|
|
960
|
+
apply: 'build',
|
|
994
961
|
load: function load(id) {
|
|
995
962
|
if (excludeFn(id)) {
|
|
996
963
|
return;
|
|
@@ -998,16 +965,20 @@
|
|
|
998
965
|
parseStartSet.add(id);
|
|
999
966
|
}
|
|
1000
967
|
}, {
|
|
1001
|
-
enforce:
|
|
1002
|
-
name:
|
|
1003
|
-
apply:
|
|
968
|
+
enforce: 'post',
|
|
969
|
+
name: 'parseEnd',
|
|
970
|
+
apply: 'build',
|
|
1004
971
|
moduleParsed: function moduleParsed(module) {
|
|
1005
972
|
var id = module.id;
|
|
1006
973
|
if (excludeFn(id)) {
|
|
1007
974
|
return;
|
|
1008
975
|
}
|
|
976
|
+
if (id === VIRTUAL_EXPOSES) {
|
|
977
|
+
// When the entry JS file is empty and only contains exposes export code, it’s necessary to wait for the exposes modules to be resolved in order to collect the dependencies being used.
|
|
978
|
+
exposesParseEnd = true;
|
|
979
|
+
}
|
|
1009
980
|
parseEndSet.add(id);
|
|
1010
|
-
if (parseStartSet.size === parseEndSet.size) {
|
|
981
|
+
if (exposesParseEnd && parseStartSet.size === parseEndSet.size) {
|
|
1011
982
|
_resolve(1);
|
|
1012
983
|
}
|
|
1013
984
|
}
|
|
@@ -1023,6 +994,9 @@
|
|
|
1023
994
|
if (id === REMOTE_ENTRY_ID) {
|
|
1024
995
|
return REMOTE_ENTRY_ID;
|
|
1025
996
|
}
|
|
997
|
+
if (id === VIRTUAL_EXPOSES) {
|
|
998
|
+
return VIRTUAL_EXPOSES;
|
|
999
|
+
}
|
|
1026
1000
|
},
|
|
1027
1001
|
load: function load(id) {
|
|
1028
1002
|
if (id === REMOTE_ENTRY_ID) {
|
|
@@ -1030,6 +1004,9 @@
|
|
|
1030
1004
|
return generateRemoteEntry(getNormalizeModuleFederationOptions());
|
|
1031
1005
|
});
|
|
1032
1006
|
}
|
|
1007
|
+
if (id === VIRTUAL_EXPOSES) {
|
|
1008
|
+
return generateExposes();
|
|
1009
|
+
}
|
|
1033
1010
|
},
|
|
1034
1011
|
transform: function transform(code, id) {
|
|
1035
1012
|
try {
|
|
@@ -1039,6 +1016,9 @@
|
|
|
1039
1016
|
return generateRemoteEntry(getNormalizeModuleFederationOptions());
|
|
1040
1017
|
}));
|
|
1041
1018
|
}
|
|
1019
|
+
if (id === VIRTUAL_EXPOSES) {
|
|
1020
|
+
return Promise.resolve(generateExposes());
|
|
1021
|
+
}
|
|
1042
1022
|
return Promise.resolve();
|
|
1043
1023
|
} catch (e) {
|
|
1044
1024
|
return Promise.reject(e);
|
|
@@ -1051,14 +1031,14 @@
|
|
|
1051
1031
|
function pluginProxyRemotes (options) {
|
|
1052
1032
|
var remotes = options.remotes;
|
|
1053
1033
|
return {
|
|
1054
|
-
name:
|
|
1034
|
+
name: 'proxyRemotes',
|
|
1055
1035
|
config: function config(_config, _ref) {
|
|
1056
1036
|
var _command = _ref.command;
|
|
1057
1037
|
Object.keys(remotes).forEach(function (key) {
|
|
1058
1038
|
var remote = remotes[key];
|
|
1059
1039
|
_config.resolve.alias.push({
|
|
1060
1040
|
find: new RegExp("^(" + remote.name + "(/.*|$))"),
|
|
1061
|
-
replacement:
|
|
1041
|
+
replacement: '$1',
|
|
1062
1042
|
customResolver: function customResolver(source) {
|
|
1063
1043
|
var remoteModule = getRemoteVirtualModule(source, _command);
|
|
1064
1044
|
addUsedRemote(remote.name, source);
|
|
@@ -1112,8 +1092,8 @@
|
|
|
1112
1092
|
shared = _options$shared === void 0 ? {} : _options$shared;
|
|
1113
1093
|
var _config;
|
|
1114
1094
|
return [{
|
|
1115
|
-
name:
|
|
1116
|
-
enforce:
|
|
1095
|
+
name: 'generateLocalSharedImportMap',
|
|
1096
|
+
enforce: 'post',
|
|
1117
1097
|
load: function load(id) {
|
|
1118
1098
|
if (id.includes(getLocalSharedImportMapPath())) {
|
|
1119
1099
|
return parsePromise.then(function (_) {
|
|
@@ -1138,11 +1118,11 @@
|
|
|
1138
1118
|
var _config2$resolve$alia, _config2$resolve$alia2;
|
|
1139
1119
|
var command = _ref.command;
|
|
1140
1120
|
(_config2$resolve$alia = _config2.resolve.alias).push.apply(_config2$resolve$alia, Object.keys(shared).map(function (key) {
|
|
1141
|
-
var pattern = key.endsWith(
|
|
1121
|
+
var pattern = key.endsWith('/') ? "(^" + key.replace(/\/$/, '') + "(/.+)?$)" : "(^" + key + "$)";
|
|
1142
1122
|
return {
|
|
1143
1123
|
// Intercept all shared requests and proxy them to loadShare
|
|
1144
1124
|
find: new RegExp(pattern),
|
|
1145
|
-
replacement:
|
|
1125
|
+
replacement: '$1',
|
|
1146
1126
|
customResolver: function customResolver(source, importer) {
|
|
1147
1127
|
if (/\.css$/.test(source)) return;
|
|
1148
1128
|
var loadSharePath = getLoadShareModulePath(source);
|
|
@@ -1156,7 +1136,7 @@
|
|
|
1156
1136
|
}));
|
|
1157
1137
|
var savePrebuild = new PromiseStore();
|
|
1158
1138
|
(_config2$resolve$alia2 = _config2.resolve.alias).push.apply(_config2$resolve$alia2, Object.keys(shared).map(function (key) {
|
|
1159
|
-
return command ===
|
|
1139
|
+
return command === 'build' ? {
|
|
1160
1140
|
find: new RegExp("(.*" + PREBUILD_TAG + ".*)"),
|
|
1161
1141
|
replacement: function replacement($1) {
|
|
1162
1142
|
var pkgName = VirtualModule.findModule(PREBUILD_TAG, $1).name;
|
|
@@ -1164,7 +1144,7 @@
|
|
|
1164
1144
|
}
|
|
1165
1145
|
} : {
|
|
1166
1146
|
find: new RegExp("(.*" + PREBUILD_TAG + ".*)"),
|
|
1167
|
-
replacement:
|
|
1147
|
+
replacement: '$1',
|
|
1168
1148
|
customResolver: function customResolver(source, importer) {
|
|
1169
1149
|
try {
|
|
1170
1150
|
var _this = this;
|
|
@@ -1190,8 +1170,8 @@
|
|
|
1190
1170
|
}));
|
|
1191
1171
|
}
|
|
1192
1172
|
}, {
|
|
1193
|
-
name:
|
|
1194
|
-
apply:
|
|
1173
|
+
name: 'watchLocalSharedImportMap',
|
|
1174
|
+
apply: 'serve',
|
|
1195
1175
|
config: function config(_config3) {
|
|
1196
1176
|
_config3.optimizeDeps = defu.defu(_config3.optimizeDeps, {
|
|
1197
1177
|
exclude: [getLocalSharedImportMapPath()]
|
|
@@ -1248,7 +1228,7 @@
|
|
|
1248
1228
|
var name = options.name,
|
|
1249
1229
|
shared = options.shared,
|
|
1250
1230
|
filename = options.filename;
|
|
1251
|
-
if (!name) throw new Error(
|
|
1231
|
+
if (!name) throw new Error('name is required');
|
|
1252
1232
|
return [aliasToArrayPlugin, normalizeOptimizeDepsPlugin].concat(addEntry({
|
|
1253
1233
|
entryName: 'remoteEntry',
|
|
1254
1234
|
entryPath: REMOTE_ENTRY_ID,
|
|
@@ -1256,6 +1236,9 @@
|
|
|
1256
1236
|
}), addEntry({
|
|
1257
1237
|
entryName: 'hostInit',
|
|
1258
1238
|
entryPath: getHostAutoInitPath()
|
|
1239
|
+
}), addEntry({
|
|
1240
|
+
entryName: 'virtualExposes',
|
|
1241
|
+
entryPath: VIRTUAL_EXPOSES
|
|
1259
1242
|
}), [pluginProxyRemoteEntry(), pluginProxyRemotes(options)], pluginModuleParseEnd(function (id) {
|
|
1260
1243
|
return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(getLocalSharedImportMapPath());
|
|
1261
1244
|
}), proxySharedModule({
|
|
@@ -1265,6 +1248,7 @@
|
|
|
1265
1248
|
enforce: 'post',
|
|
1266
1249
|
config: function config(_config, _ref) {
|
|
1267
1250
|
var _config$optimizeDeps;
|
|
1251
|
+
// TODO: singleton
|
|
1268
1252
|
_config.resolve.alias.push({
|
|
1269
1253
|
find: '@module-federation/runtime',
|
|
1270
1254
|
replacement: require.resolve('@module-federation/runtime')
|