@module-federation/data-prefetch 0.0.0-next-20240927185728 → 0.0.0-next-20240930063850
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/.swcrc +29 -0
- package/CHANGELOG.md +13 -3
- package/dist/babel.cjs.js +23 -35
- package/dist/babel.esm.d.ts +2 -0
- package/dist/babel.esm.js +23 -31
- package/dist/cli.cjs.js +122 -3546
- package/dist/cli.esm.d.ts +1 -0
- package/dist/cli.esm.js +123 -3536
- package/dist/index.cjs.js +0 -2
- package/dist/index.esm.d.ts +1 -0
- package/dist/package.json +7 -6
- package/dist/plugin.cjs.js +95 -298
- package/dist/plugin.esm.d.ts +2 -0
- package/dist/plugin.esm.js +94 -297
- package/dist/polyfills.cjs.js +14 -0
- package/dist/polyfills.esm.js +12 -0
- package/dist/prefetch.cjs.js +118 -327
- package/dist/prefetch.esm.js +119 -328
- package/dist/react.cjs.js +31 -117
- package/dist/react.esm.d.ts +1 -0
- package/dist/react.esm.js +32 -116
- package/dist/runtime-utils.cjs.js +4 -8
- package/dist/runtime-utils.esm.js +5 -9
- package/dist/shared.cjs.js +10 -12
- package/dist/shared.esm.d.ts +2 -0
- package/dist/shared.esm.js +10 -12
- package/dist/universal.cjs.js +8 -17
- package/dist/universal.esm.d.ts +1 -0
- package/dist/universal.esm.js +9 -16
- package/package.json +5 -5
- package/project.json +2 -2
- package/rollup.config.js +22 -1
package/dist/react.esm.js
CHANGED
|
@@ -1,147 +1,63 @@
|
|
|
1
|
+
import { _ as _extends } from './polyfills.esm.js';
|
|
1
2
|
import { useRef, useEffect, useState } from 'react';
|
|
2
3
|
import { l as logger } from './index.esm2.js';
|
|
3
4
|
import { M as MFDataPrefetch } from './prefetch.esm.js';
|
|
4
5
|
import { prefetch } from './universal.esm.js';
|
|
5
|
-
import {
|
|
6
|
+
import { g as getScope } from './runtime-utils.esm.js';
|
|
6
7
|
import '@module-federation/sdk';
|
|
7
8
|
import '@module-federation/runtime';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
useEffect(
|
|
10
|
+
const useFirstMounted = ()=>{
|
|
11
|
+
const ref = useRef(true);
|
|
12
|
+
useEffect(()=>{
|
|
12
13
|
ref.current = false;
|
|
13
14
|
}, []);
|
|
14
15
|
return ref.current;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
20
|
-
return arr2;
|
|
21
|
-
}
|
|
22
|
-
function _array_with_holes(arr) {
|
|
23
|
-
if (Array.isArray(arr)) return arr;
|
|
24
|
-
}
|
|
25
|
-
function _define_property(obj, key, value) {
|
|
26
|
-
if (key in obj) {
|
|
27
|
-
Object.defineProperty(obj, key, {
|
|
28
|
-
value: value,
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true,
|
|
31
|
-
writable: true
|
|
32
|
-
});
|
|
33
|
-
} else {
|
|
34
|
-
obj[key] = value;
|
|
35
|
-
}
|
|
36
|
-
return obj;
|
|
37
|
-
}
|
|
38
|
-
function _instanceof(left, right) {
|
|
39
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
40
|
-
return !!right[Symbol.hasInstance](left);
|
|
41
|
-
} else {
|
|
42
|
-
return left instanceof right;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function _iterable_to_array_limit(arr, i) {
|
|
46
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
47
|
-
if (_i == null) return;
|
|
48
|
-
var _arr = [];
|
|
49
|
-
var _n = true;
|
|
50
|
-
var _d = false;
|
|
51
|
-
var _s, _e;
|
|
52
|
-
try {
|
|
53
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
54
|
-
_arr.push(_s.value);
|
|
55
|
-
if (i && _arr.length === i) break;
|
|
56
|
-
}
|
|
57
|
-
} catch (err) {
|
|
58
|
-
_d = true;
|
|
59
|
-
_e = err;
|
|
60
|
-
} finally{
|
|
61
|
-
try {
|
|
62
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
63
|
-
} finally{
|
|
64
|
-
if (_d) throw _e;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return _arr;
|
|
68
|
-
}
|
|
69
|
-
function _non_iterable_rest() {
|
|
70
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
-
}
|
|
72
|
-
function _object_spread(target) {
|
|
73
|
-
for(var i = 1; i < arguments.length; i++){
|
|
74
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
75
|
-
var ownKeys = Object.keys(source);
|
|
76
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
77
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
78
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
ownKeys.forEach(function(key) {
|
|
82
|
-
_define_property(target, key, source[key]);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return target;
|
|
86
|
-
}
|
|
87
|
-
function _sliced_to_array(arr, i) {
|
|
88
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
89
|
-
}
|
|
90
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
91
|
-
if (!o) return;
|
|
92
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
93
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
94
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
95
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
96
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
97
|
-
}
|
|
98
|
-
var usePrefetch = function(options) {
|
|
99
|
-
var isFirstMounted = useFirstMounted();
|
|
18
|
+
const usePrefetch = (options)=>{
|
|
19
|
+
const isFirstMounted = useFirstMounted();
|
|
100
20
|
if (isFirstMounted) {
|
|
101
|
-
|
|
102
|
-
logger.info(
|
|
21
|
+
const startTiming = performance.now();
|
|
22
|
+
logger.info(`2. Start Get Prefetch Data: ${options.id} - ${options.functionId || 'default'} - ${startTiming}`);
|
|
103
23
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
id
|
|
107
|
-
functionId
|
|
24
|
+
const { id, functionId, deferId } = options;
|
|
25
|
+
const prefetchInfo = {
|
|
26
|
+
id,
|
|
27
|
+
functionId
|
|
108
28
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
29
|
+
const mfScope = getScope();
|
|
30
|
+
let state;
|
|
31
|
+
const prefetchResult = prefetch(options);
|
|
112
32
|
if (deferId) {
|
|
113
|
-
if (
|
|
114
|
-
state = prefetchResult.then(
|
|
115
|
-
return deferredData.data[deferId];
|
|
116
|
-
});
|
|
33
|
+
if (prefetchResult instanceof Promise) {
|
|
34
|
+
state = prefetchResult.then((deferredData)=>deferredData.data[deferId]);
|
|
117
35
|
} else {
|
|
118
36
|
state = prefetchResult.data[deferId];
|
|
119
37
|
}
|
|
120
38
|
} else {
|
|
121
39
|
state = prefetchResult;
|
|
122
40
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
useEffect(
|
|
126
|
-
|
|
127
|
-
logger.info(
|
|
128
|
-
return
|
|
129
|
-
prefetchInstance
|
|
41
|
+
const [prefetchState, setPrefetchState] = useState(state);
|
|
42
|
+
const prefetchInstance = MFDataPrefetch.getInstance(mfScope);
|
|
43
|
+
useEffect(()=>{
|
|
44
|
+
const useEffectTiming = performance.now();
|
|
45
|
+
logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);
|
|
46
|
+
return ()=>{
|
|
47
|
+
prefetchInstance == null ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);
|
|
130
48
|
};
|
|
131
49
|
}, []);
|
|
132
|
-
|
|
133
|
-
|
|
50
|
+
const refreshExecutor = (refetchParams)=>{
|
|
51
|
+
const refetchOptions = _extends({}, options);
|
|
134
52
|
if (refetchParams) {
|
|
135
53
|
refetchOptions.refetchParams = refetchParams;
|
|
136
54
|
}
|
|
137
|
-
prefetchInstance
|
|
138
|
-
|
|
139
|
-
|
|
55
|
+
prefetchInstance == null ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);
|
|
56
|
+
const newVal = prefetch(refetchOptions);
|
|
57
|
+
let newState;
|
|
140
58
|
if (deferId) {
|
|
141
|
-
if (
|
|
142
|
-
newState = newVal.then(
|
|
143
|
-
return deferredData.data[deferId];
|
|
144
|
-
});
|
|
59
|
+
if (newVal instanceof Promise) {
|
|
60
|
+
newState = newVal.then((deferredData)=>deferredData.data[deferId]);
|
|
145
61
|
} else {
|
|
146
62
|
newState = newVal.data[deferId];
|
|
147
63
|
}
|
|
@@ -3,16 +3,12 @@
|
|
|
3
3
|
var runtime = require('@module-federation/runtime');
|
|
4
4
|
var sdk = require('@module-federation/sdk');
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const getScope = ()=>{
|
|
7
7
|
return runtime.getInstance().options.name;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var compatGetPrefetchId = function(id) {
|
|
13
|
-
return sdk.encodeName("".concat(id, "/VmokPrefetch"));
|
|
14
|
-
};
|
|
15
|
-
var getSignalFromManifest = function(remoteSnapshot) {
|
|
9
|
+
const getPrefetchId = (id)=>sdk.encodeName(`${id}/${sdk.MFPrefetchCommon.identifier}`);
|
|
10
|
+
const compatGetPrefetchId = (id)=>sdk.encodeName(`${id}/VmokPrefetch`);
|
|
11
|
+
const getSignalFromManifest = (remoteSnapshot)=>{
|
|
16
12
|
if (!remoteSnapshot) {
|
|
17
13
|
return false;
|
|
18
14
|
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { getInstance } from '@module-federation/runtime';
|
|
2
2
|
import { encodeName, MFPrefetchCommon } from '@module-federation/sdk';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const getScope = ()=>{
|
|
5
5
|
return getInstance().options.name;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var compatGetPrefetchId = function(id) {
|
|
11
|
-
return encodeName("".concat(id, "/VmokPrefetch"));
|
|
12
|
-
};
|
|
13
|
-
var getSignalFromManifest = function(remoteSnapshot) {
|
|
7
|
+
const getPrefetchId = (id)=>encodeName(`${id}/${MFPrefetchCommon.identifier}`);
|
|
8
|
+
const compatGetPrefetchId = (id)=>encodeName(`${id}/VmokPrefetch`);
|
|
9
|
+
const getSignalFromManifest = (remoteSnapshot)=>{
|
|
14
10
|
if (!remoteSnapshot) {
|
|
15
11
|
return false;
|
|
16
12
|
}
|
|
@@ -23,4 +19,4 @@ var getSignalFromManifest = function(remoteSnapshot) {
|
|
|
23
19
|
return true;
|
|
24
20
|
};
|
|
25
21
|
|
|
26
|
-
export { getSignalFromManifest as a,
|
|
22
|
+
export { getSignalFromManifest as a, getPrefetchId as b, compatGetPrefetchId as c, getScope as g };
|
package/dist/shared.cjs.js
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
return {
|
|
3
|
+
const sharedStrategy = ()=>({
|
|
5
4
|
name: 'shared-strategy',
|
|
6
|
-
beforeInit
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
beforeInit (args) {
|
|
6
|
+
const { userOptions } = args;
|
|
7
|
+
const shared = userOptions.shared;
|
|
9
8
|
if (shared) {
|
|
10
|
-
Object.keys(shared).forEach(
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
Object.keys(shared).forEach((sharedKey)=>{
|
|
10
|
+
const sharedConfigs = shared[sharedKey];
|
|
11
|
+
const arraySharedConfigs = Array.isArray(sharedConfigs) ? sharedConfigs : [
|
|
13
12
|
sharedConfigs
|
|
14
13
|
];
|
|
15
|
-
arraySharedConfigs.forEach(
|
|
14
|
+
arraySharedConfigs.forEach((s)=>{
|
|
16
15
|
s.strategy = 'loaded-first';
|
|
17
16
|
});
|
|
18
17
|
});
|
|
19
|
-
console.warn(
|
|
18
|
+
console.warn(`[Module Federation Data Prefetch]: Your shared strategy is set to 'loaded-first', this is a necessary condition for data prefetch`);
|
|
20
19
|
}
|
|
21
20
|
return args;
|
|
22
21
|
}
|
|
23
|
-
};
|
|
24
|
-
};
|
|
22
|
+
});
|
|
25
23
|
|
|
26
24
|
module.exports = sharedStrategy;
|
package/dist/shared.esm.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
return {
|
|
1
|
+
const sharedStrategy = ()=>({
|
|
3
2
|
name: 'shared-strategy',
|
|
4
|
-
beforeInit
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
beforeInit (args) {
|
|
4
|
+
const { userOptions } = args;
|
|
5
|
+
const shared = userOptions.shared;
|
|
7
6
|
if (shared) {
|
|
8
|
-
Object.keys(shared).forEach(
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
Object.keys(shared).forEach((sharedKey)=>{
|
|
8
|
+
const sharedConfigs = shared[sharedKey];
|
|
9
|
+
const arraySharedConfigs = Array.isArray(sharedConfigs) ? sharedConfigs : [
|
|
11
10
|
sharedConfigs
|
|
12
11
|
];
|
|
13
|
-
arraySharedConfigs.forEach(
|
|
12
|
+
arraySharedConfigs.forEach((s)=>{
|
|
14
13
|
s.strategy = 'loaded-first';
|
|
15
14
|
});
|
|
16
15
|
});
|
|
17
|
-
console.warn(
|
|
16
|
+
console.warn(`[Module Federation Data Prefetch]: Your shared strategy is set to 'loaded-first', this is a necessary condition for data prefetch`);
|
|
18
17
|
}
|
|
19
18
|
return args;
|
|
20
19
|
}
|
|
21
|
-
};
|
|
22
|
-
};
|
|
20
|
+
});
|
|
23
21
|
|
|
24
22
|
export { sharedStrategy as default };
|
package/dist/universal.cjs.js
CHANGED
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var prefetch$1 = require('./prefetch.cjs.js');
|
|
6
4
|
var runtimeUtils = require('./runtime-utils.cjs.js');
|
|
7
5
|
require('@module-federation/runtime');
|
|
8
6
|
require('@module-federation/sdk');
|
|
9
7
|
|
|
10
|
-
function _instanceof(left, right) {
|
|
11
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
12
|
-
return !!right[Symbol.hasInstance](left);
|
|
13
|
-
} else {
|
|
14
|
-
return left instanceof right;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
8
|
function prefetch(options) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
const { id, functionId = 'default' } = options;
|
|
10
|
+
const mfScope = runtimeUtils.getScope();
|
|
11
|
+
const prefetchInstance = prefetch$1.MFDataPrefetch.getInstance(mfScope) || new prefetch$1.MFDataPrefetch({
|
|
21
12
|
name: mfScope
|
|
22
13
|
});
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
const res = prefetchInstance.getProjectExports();
|
|
15
|
+
if (res instanceof Promise) {
|
|
16
|
+
const promise = res.then(()=>{
|
|
17
|
+
const result = prefetchInstance.prefetch(options);
|
|
27
18
|
prefetchInstance.memorize(id + functionId, result);
|
|
28
19
|
return result;
|
|
29
20
|
});
|
|
30
21
|
return promise;
|
|
31
22
|
} else {
|
|
32
|
-
|
|
23
|
+
const result = prefetchInstance.prefetch(options);
|
|
33
24
|
prefetchInstance.memorize(id + functionId, result);
|
|
34
25
|
return result;
|
|
35
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/universal/index";
|
package/dist/universal.esm.js
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import { M as MFDataPrefetch } from './prefetch.esm.js';
|
|
2
|
-
import {
|
|
2
|
+
import { g as getScope } from './runtime-utils.esm.js';
|
|
3
3
|
import '@module-federation/runtime';
|
|
4
4
|
import '@module-federation/sdk';
|
|
5
5
|
|
|
6
|
-
function _instanceof(left, right) {
|
|
7
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
8
|
-
return !!right[Symbol.hasInstance](left);
|
|
9
|
-
} else {
|
|
10
|
-
return left instanceof right;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
6
|
function prefetch(options) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const { id, functionId = 'default' } = options;
|
|
8
|
+
const mfScope = getScope();
|
|
9
|
+
const prefetchInstance = MFDataPrefetch.getInstance(mfScope) || new MFDataPrefetch({
|
|
17
10
|
name: mfScope
|
|
18
11
|
});
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
const res = prefetchInstance.getProjectExports();
|
|
13
|
+
if (res instanceof Promise) {
|
|
14
|
+
const promise = res.then(()=>{
|
|
15
|
+
const result = prefetchInstance.prefetch(options);
|
|
23
16
|
prefetchInstance.memorize(id + functionId, result);
|
|
24
17
|
return result;
|
|
25
18
|
});
|
|
26
19
|
return promise;
|
|
27
20
|
} else {
|
|
28
|
-
|
|
21
|
+
const result = prefetchInstance.prefetch(options);
|
|
29
22
|
prefetchInstance.memorize(id + functionId, result);
|
|
30
23
|
return result;
|
|
31
24
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/data-prefetch",
|
|
3
3
|
"description": "Module Federation Data Prefetch",
|
|
4
|
-
"version": "0.0.0-next-
|
|
4
|
+
"version": "0.0.0-next-20240930063850",
|
|
5
5
|
"author": "nieyan <nyqykk@foxmail.com>",
|
|
6
6
|
"homepage": "https://github.com/module-federation/core",
|
|
7
7
|
"license": "MIT",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"jest": "^29.7.0",
|
|
79
79
|
"jest-environment-jsdom": "^29.7.0",
|
|
80
80
|
"minimist": "^1.2.8",
|
|
81
|
-
"react": "^18.
|
|
82
|
-
"react-dom": "^18.
|
|
81
|
+
"react": "^18.3.1",
|
|
82
|
+
"react-dom": "^18.3.1",
|
|
83
83
|
"react-router": "^6.21.3",
|
|
84
84
|
"react-test-renderer": "^18.2.0",
|
|
85
85
|
"ts-jest": "29.0.1",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"fs-extra": "9.1.0",
|
|
91
|
-
"@module-federation/
|
|
92
|
-
"@module-federation/
|
|
91
|
+
"@module-federation/runtime": "0.0.0-next-20240930063850",
|
|
92
|
+
"@module-federation/sdk": "0.0.0-next-20240930063850"
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|
|
95
95
|
"dev": "cross-env WATCH=true tsup",
|
package/project.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
4
|
"sourceRoot": "packages/data-prefetch/src",
|
|
5
5
|
"projectType": "library",
|
|
6
|
+
"tags": ["type:pkg"],
|
|
6
7
|
"targets": {
|
|
7
8
|
"build": {
|
|
8
9
|
"executor": "@nx/rollup:rollup",
|
|
@@ -58,6 +59,5 @@
|
|
|
58
59
|
]
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
}
|
|
62
|
-
"tags": ["type:pkg"]
|
|
62
|
+
}
|
|
63
63
|
}
|
package/rollup.config.js
CHANGED
|
@@ -20,6 +20,27 @@ module.exports = (rollupConfig, _projectOptions) => {
|
|
|
20
20
|
plugin: 'packages/data-prefetch/src/plugin.ts',
|
|
21
21
|
shared: 'packages/data-prefetch/src/shared/index.ts',
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
if (Array.isArray(rollupConfig.output)) {
|
|
25
|
+
rollupConfig.output = rollupConfig.output.map((c) => ({
|
|
26
|
+
...c,
|
|
27
|
+
manualChunks: (id) => {
|
|
28
|
+
if (id.includes('@swc/helpers')) {
|
|
29
|
+
return 'polyfills';
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
} else {
|
|
34
|
+
rollupConfig.output = {
|
|
35
|
+
...rollupConfig.output,
|
|
36
|
+
manualChunks: (id) => {
|
|
37
|
+
if (id.includes('@swc/helpers')) {
|
|
38
|
+
return 'polyfills';
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// rollupConfig.external = [/@module-federation/];
|
|
24
45
|
return rollupConfig;
|
|
25
46
|
};
|