@module-federation/bridge-react 0.0.0-next-20241118095355 → 0.0.0-next-20241119071808
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/CHANGELOG.md +5 -4
- package/dist/index.cjs.js +38 -22
- package/dist/index.d.ts +23 -7
- package/dist/index.es.js +39 -21
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.d.ts +6 -0
- package/dist/plugin.es.js +4 -0
- package/dist/router-v6.cjs.js +3 -2
- package/dist/router-v6.d.ts +1 -1
- package/dist/router-v6.es.js +7 -7
- package/package.json +10 -5
- package/src/create.tsx +22 -8
- package/src/index.ts +21 -2
- package/src/plugin.ts +2 -0
- package/src/provider.tsx +18 -6
- package/src/remote/index.tsx +9 -10
- package/src/router-v5.tsx +1 -1
- package/src/router-v6.tsx +2 -1
- package/src/utils.ts +0 -1
- package/vite.config.ts +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# @module-federation/bridge-react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20241119071808
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- @module-federation/
|
|
7
|
+
- c7dbc4b: feat: mount bridge api to module instance
|
|
8
|
+
- 0309fb5: fix: wrap try catch with react-router-dom path resolve
|
|
9
|
+
- @module-federation/sdk@0.0.0-next-20241119071808
|
|
10
|
+
- @module-federation/bridge-shared@0.0.0-next-20241119071808
|
|
10
11
|
|
|
11
12
|
## 0.7.4
|
|
12
13
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const context = require("./context-BcJ-YlNr.cjs");
|
|
5
5
|
const ReactRouterDOM = require("react-router-dom");
|
|
6
|
-
const runtime = require("@module-federation/runtime");
|
|
7
6
|
const ReactDOM = require("react-dom");
|
|
8
7
|
function _interopNamespaceDefault(e2) {
|
|
9
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -133,13 +132,13 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
|
|
|
133
132
|
className,
|
|
134
133
|
style,
|
|
135
134
|
fallback,
|
|
135
|
+
instance,
|
|
136
136
|
...resProps
|
|
137
137
|
} = props;
|
|
138
138
|
const rootRef = ref && "current" in ref ? ref : React.useRef(null);
|
|
139
139
|
const renderDom = React.useRef(null);
|
|
140
140
|
const providerInfoRef = React.useRef(null);
|
|
141
|
-
|
|
142
|
-
context.LoggerInstance.log(`RemoteAppWrapper hostInstance >>>`, hostInstance);
|
|
141
|
+
context.LoggerInstance.log(`RemoteAppWrapper instance from props >>>`, instance);
|
|
143
142
|
React.useEffect(() => {
|
|
144
143
|
const renderTimeout = setTimeout(() => {
|
|
145
144
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -160,16 +159,14 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
|
|
|
160
159
|
);
|
|
161
160
|
context.LoggerInstance.log(
|
|
162
161
|
`createRemoteComponent LazyComponent hostInstance >>>`,
|
|
163
|
-
|
|
162
|
+
instance
|
|
164
163
|
);
|
|
165
|
-
const beforeBridgeRenderRes = ((_c = (_b = (_a =
|
|
164
|
+
const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(
|
|
166
165
|
renderProps
|
|
167
166
|
)) || {};
|
|
168
167
|
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
|
|
169
168
|
providerReturn.render(renderProps);
|
|
170
|
-
(_f = (_e = (_d =
|
|
171
|
-
renderProps
|
|
172
|
-
);
|
|
169
|
+
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(renderProps);
|
|
173
170
|
});
|
|
174
171
|
return () => {
|
|
175
172
|
clearTimeout(renderTimeout);
|
|
@@ -180,7 +177,7 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
|
|
|
180
177
|
`createRemoteComponent LazyComponent destroy >>>`,
|
|
181
178
|
{ moduleName, basename, dom: renderDom.current }
|
|
182
179
|
);
|
|
183
|
-
(_d = (_c = (_b =
|
|
180
|
+
(_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit({
|
|
184
181
|
moduleName,
|
|
185
182
|
dom: renderDom.current,
|
|
186
183
|
basename,
|
|
@@ -192,7 +189,7 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
|
|
|
192
189
|
moduleName,
|
|
193
190
|
dom: renderDom.current
|
|
194
191
|
});
|
|
195
|
-
(_h = (_g = (_f =
|
|
192
|
+
(_h = (_g = (_f = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _f.lifecycle) == null ? void 0 : _g.afterBridgeDestroy) == null ? void 0 : _h.emit({
|
|
196
193
|
moduleName,
|
|
197
194
|
dom: renderDom.current,
|
|
198
195
|
basename,
|
|
@@ -308,6 +305,7 @@ function createLazyRemoteComponent(info) {
|
|
|
308
305
|
exportName: info.export || "default",
|
|
309
306
|
fallback: info.fallback,
|
|
310
307
|
ref,
|
|
308
|
+
instance: info.instance,
|
|
311
309
|
...props
|
|
312
310
|
}
|
|
313
311
|
);
|
|
@@ -331,13 +329,10 @@ function createLazyRemoteComponent(info) {
|
|
|
331
329
|
}
|
|
332
330
|
});
|
|
333
331
|
}
|
|
334
|
-
function
|
|
335
|
-
return
|
|
336
|
-
(
|
|
337
|
-
|
|
338
|
-
return /* @__PURE__ */ React.createElement(ErrorBoundary, { FallbackComponent: info.fallback }, /* @__PURE__ */ React.createElement(React.Suspense, { fallback: info.loading }, /* @__PURE__ */ React.createElement(LazyComponent, { ...props, ref })));
|
|
339
|
-
}
|
|
340
|
-
);
|
|
332
|
+
function createRemoteComponentWithInstance(instance) {
|
|
333
|
+
return (info) => {
|
|
334
|
+
return createLazyRemoteComponent({ ...info, instance });
|
|
335
|
+
};
|
|
341
336
|
}
|
|
342
337
|
var client = {};
|
|
343
338
|
var m = ReactDOM;
|
|
@@ -366,8 +361,11 @@ if (process.env.NODE_ENV === "production") {
|
|
|
366
361
|
function createBridgeComponent(bridgeInfo) {
|
|
367
362
|
return () => {
|
|
368
363
|
const rootMap = /* @__PURE__ */ new Map();
|
|
369
|
-
const instance =
|
|
370
|
-
context.LoggerInstance.log(
|
|
364
|
+
const { instance } = bridgeInfo;
|
|
365
|
+
context.LoggerInstance.log(
|
|
366
|
+
`createBridgeComponent instance from props >>>`,
|
|
367
|
+
instance
|
|
368
|
+
);
|
|
371
369
|
const RawComponent = (info) => {
|
|
372
370
|
const { appInfo, propsInfo, ...restProps } = info;
|
|
373
371
|
const { moduleName, memoryRoute, basename = "/" } = appInfo;
|
|
@@ -436,7 +434,9 @@ function createBridgeComponent(bridgeInfo) {
|
|
|
436
434
|
} else {
|
|
437
435
|
ReactDOM.unmountComponentAtNode(info.dom);
|
|
438
436
|
}
|
|
439
|
-
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy) == null ? void 0 : _f.emit(
|
|
437
|
+
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy) == null ? void 0 : _f.emit(
|
|
438
|
+
info
|
|
439
|
+
);
|
|
440
440
|
},
|
|
441
441
|
rawComponent: bridgeInfo.rootComponent,
|
|
442
442
|
__BRIDGE_FN__: (_args) => {
|
|
@@ -444,5 +444,21 @@ function createBridgeComponent(bridgeInfo) {
|
|
|
444
444
|
};
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
|
|
448
|
-
|
|
447
|
+
function createBridgeComponentWithInstance(instance) {
|
|
448
|
+
return (bridgeInfo) => {
|
|
449
|
+
return createBridgeComponent({ ...bridgeInfo, instance });
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
exports.createRemoteComponent = void 0;
|
|
453
|
+
exports.createBridgeComponent = void 0;
|
|
454
|
+
function BridgeReactPlugin() {
|
|
455
|
+
return {
|
|
456
|
+
name: "bridge-react-plugin",
|
|
457
|
+
beforeInit(args) {
|
|
458
|
+
exports.createRemoteComponent = createRemoteComponentWithInstance(args.origin);
|
|
459
|
+
exports.createBridgeComponent = createBridgeComponentWithInstance(args.origin);
|
|
460
|
+
return args;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
exports.BridgeReactPlugin = BridgeReactPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,22 +2,29 @@ import { ComponentType } from 'react';
|
|
|
2
2
|
import { default as default_2 } from 'react';
|
|
3
3
|
import { default as default_3 } from 'react-dom/client';
|
|
4
4
|
import { ErrorInfo } from 'react';
|
|
5
|
+
import { FederationHost } from '@module-federation/runtime';
|
|
6
|
+
import { FederationRuntimePlugin } from '@module-federation/runtime';
|
|
5
7
|
import { PropsWithChildren } from 'react';
|
|
6
8
|
import * as React_2 from 'react';
|
|
7
9
|
|
|
8
|
-
export declare function
|
|
10
|
+
export declare function BridgeReactPlugin(): FederationRuntimePlugin;
|
|
11
|
+
|
|
12
|
+
declare type CreateBridgeComponent = typeof createBridgeComponent_2;
|
|
13
|
+
|
|
14
|
+
export declare let createBridgeComponent: CreateBridgeComponent;
|
|
15
|
+
|
|
16
|
+
declare function createBridgeComponent_2<T>(bridgeInfo: ProviderFnParams<T>): () => {
|
|
9
17
|
render(info: RenderParams): Promise<void>;
|
|
10
18
|
destroy(info: DestroyParams): Promise<void>;
|
|
11
19
|
rawComponent: React_2.ComponentType<T>;
|
|
12
20
|
__BRIDGE_FN__: (_args: T) => void;
|
|
13
21
|
};
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}): default_2.ForwardRefExoticComponent<default_2.PropsWithoutRef<ProviderParams & ("__BRIDGE_FN__" extends keyof (T[E] extends (...args: any) => any ? ReturnType<T[E]> : never) ? (T[E] extends (...args: any) => any ? ReturnType<T[E]> : never)["__BRIDGE_FN__"] extends (...args: any) => any ? Parameters<(T[E] extends (...args: any) => any ? ReturnType<T[E]> : never)["__BRIDGE_FN__"]>[0] : {} : {})> & default_2.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
declare type CreateRemoteComponent = typeof createRemoteComponent_2;
|
|
24
|
+
|
|
25
|
+
export declare let createRemoteComponent: CreateRemoteComponent;
|
|
26
|
+
|
|
27
|
+
declare function createRemoteComponent_2<T, E extends keyof T>(info: LazyRemoteComponentInfo<T, E>): default_2.ForwardRefExoticComponent<default_2.PropsWithoutRef<ProviderParams & ("__BRIDGE_FN__" extends keyof (T[E] extends (...args: any) => any ? ReturnType<T[E]> : never) ? (T[E] extends (...args: any) => any ? ReturnType<T[E]> : never)["__BRIDGE_FN__"] extends (...args: any) => any ? Parameters<(T[E] extends (...args: any) => any ? ReturnType<T[E]> : never)["__BRIDGE_FN__"]>[0] : {} : {})> & default_2.RefAttributes<HTMLDivElement>>;
|
|
21
28
|
|
|
22
29
|
declare type DestroyParams = {
|
|
23
30
|
moduleName: string;
|
|
@@ -48,9 +55,18 @@ declare type FallbackProps = {
|
|
|
48
55
|
resetErrorBoundary: (...args: any[]) => void;
|
|
49
56
|
};
|
|
50
57
|
|
|
58
|
+
declare type LazyRemoteComponentInfo<T, E extends keyof T> = {
|
|
59
|
+
loader: () => Promise<T>;
|
|
60
|
+
loading: default_2.ReactNode;
|
|
61
|
+
fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
|
|
62
|
+
export?: E;
|
|
63
|
+
instance?: FederationHost;
|
|
64
|
+
};
|
|
65
|
+
|
|
51
66
|
declare type ProviderFnParams<T> = {
|
|
52
67
|
rootComponent: React_2.ComponentType<T>;
|
|
53
68
|
render?: (App: React_2.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
|
|
69
|
+
instance?: FederationHost;
|
|
54
70
|
};
|
|
55
71
|
|
|
56
72
|
export declare interface ProviderParams {
|
package/dist/index.es.js
CHANGED
|
@@ -2,7 +2,6 @@ import * as React from "react";
|
|
|
2
2
|
import React__default, { createContext, Component, createElement, isValidElement, forwardRef, useRef, useEffect, useContext, useState } from "react";
|
|
3
3
|
import { L as LoggerInstance, g as getRootDomDefaultClassName, p as pathJoin, a as atLeastReact18, R as RouterContext } from "./context-CUbFnlO5.js";
|
|
4
4
|
import * as ReactRouterDOM from "react-router-dom";
|
|
5
|
-
import { getInstance } from "@module-federation/runtime";
|
|
6
5
|
import ReactDOM from "react-dom";
|
|
7
6
|
const ErrorBoundaryContext = createContext(null);
|
|
8
7
|
const initialState = {
|
|
@@ -114,13 +113,13 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
114
113
|
className,
|
|
115
114
|
style,
|
|
116
115
|
fallback,
|
|
116
|
+
instance,
|
|
117
117
|
...resProps
|
|
118
118
|
} = props;
|
|
119
119
|
const rootRef = ref && "current" in ref ? ref : useRef(null);
|
|
120
120
|
const renderDom = useRef(null);
|
|
121
121
|
const providerInfoRef = useRef(null);
|
|
122
|
-
|
|
123
|
-
LoggerInstance.log(`RemoteAppWrapper hostInstance >>>`, hostInstance);
|
|
122
|
+
LoggerInstance.log(`RemoteAppWrapper instance from props >>>`, instance);
|
|
124
123
|
useEffect(() => {
|
|
125
124
|
const renderTimeout = setTimeout(() => {
|
|
126
125
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -141,16 +140,14 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
141
140
|
);
|
|
142
141
|
LoggerInstance.log(
|
|
143
142
|
`createRemoteComponent LazyComponent hostInstance >>>`,
|
|
144
|
-
|
|
143
|
+
instance
|
|
145
144
|
);
|
|
146
|
-
const beforeBridgeRenderRes = ((_c = (_b = (_a =
|
|
145
|
+
const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(
|
|
147
146
|
renderProps
|
|
148
147
|
)) || {};
|
|
149
148
|
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
|
|
150
149
|
providerReturn.render(renderProps);
|
|
151
|
-
(_f = (_e = (_d =
|
|
152
|
-
renderProps
|
|
153
|
-
);
|
|
150
|
+
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(renderProps);
|
|
154
151
|
});
|
|
155
152
|
return () => {
|
|
156
153
|
clearTimeout(renderTimeout);
|
|
@@ -161,7 +158,7 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
161
158
|
`createRemoteComponent LazyComponent destroy >>>`,
|
|
162
159
|
{ moduleName, basename, dom: renderDom.current }
|
|
163
160
|
);
|
|
164
|
-
(_d = (_c = (_b =
|
|
161
|
+
(_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit({
|
|
165
162
|
moduleName,
|
|
166
163
|
dom: renderDom.current,
|
|
167
164
|
basename,
|
|
@@ -173,7 +170,7 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
173
170
|
moduleName,
|
|
174
171
|
dom: renderDom.current
|
|
175
172
|
});
|
|
176
|
-
(_h = (_g = (_f =
|
|
173
|
+
(_h = (_g = (_f = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _f.lifecycle) == null ? void 0 : _g.afterBridgeDestroy) == null ? void 0 : _h.emit({
|
|
177
174
|
moduleName,
|
|
178
175
|
dom: renderDom.current,
|
|
179
176
|
basename,
|
|
@@ -289,6 +286,7 @@ function createLazyRemoteComponent(info) {
|
|
|
289
286
|
exportName: info.export || "default",
|
|
290
287
|
fallback: info.fallback,
|
|
291
288
|
ref,
|
|
289
|
+
instance: info.instance,
|
|
292
290
|
...props
|
|
293
291
|
}
|
|
294
292
|
);
|
|
@@ -312,13 +310,10 @@ function createLazyRemoteComponent(info) {
|
|
|
312
310
|
}
|
|
313
311
|
});
|
|
314
312
|
}
|
|
315
|
-
function
|
|
316
|
-
return
|
|
317
|
-
(
|
|
318
|
-
|
|
319
|
-
return /* @__PURE__ */ React__default.createElement(ErrorBoundary, { FallbackComponent: info.fallback }, /* @__PURE__ */ React__default.createElement(React__default.Suspense, { fallback: info.loading }, /* @__PURE__ */ React__default.createElement(LazyComponent, { ...props, ref })));
|
|
320
|
-
}
|
|
321
|
-
);
|
|
313
|
+
function createRemoteComponentWithInstance(instance) {
|
|
314
|
+
return (info) => {
|
|
315
|
+
return createLazyRemoteComponent({ ...info, instance });
|
|
316
|
+
};
|
|
322
317
|
}
|
|
323
318
|
var client = {};
|
|
324
319
|
var m = ReactDOM;
|
|
@@ -344,11 +339,14 @@ if (process.env.NODE_ENV === "production") {
|
|
|
344
339
|
}
|
|
345
340
|
};
|
|
346
341
|
}
|
|
347
|
-
function createBridgeComponent(bridgeInfo) {
|
|
342
|
+
function createBridgeComponent$1(bridgeInfo) {
|
|
348
343
|
return () => {
|
|
349
344
|
const rootMap = /* @__PURE__ */ new Map();
|
|
350
|
-
const instance =
|
|
351
|
-
LoggerInstance.log(
|
|
345
|
+
const { instance } = bridgeInfo;
|
|
346
|
+
LoggerInstance.log(
|
|
347
|
+
`createBridgeComponent instance from props >>>`,
|
|
348
|
+
instance
|
|
349
|
+
);
|
|
352
350
|
const RawComponent = (info) => {
|
|
353
351
|
const { appInfo, propsInfo, ...restProps } = info;
|
|
354
352
|
const { moduleName, memoryRoute, basename = "/" } = appInfo;
|
|
@@ -417,7 +415,9 @@ function createBridgeComponent(bridgeInfo) {
|
|
|
417
415
|
} else {
|
|
418
416
|
ReactDOM.unmountComponentAtNode(info.dom);
|
|
419
417
|
}
|
|
420
|
-
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy) == null ? void 0 : _f.emit(
|
|
418
|
+
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy) == null ? void 0 : _f.emit(
|
|
419
|
+
info
|
|
420
|
+
);
|
|
421
421
|
},
|
|
422
422
|
rawComponent: bridgeInfo.rootComponent,
|
|
423
423
|
__BRIDGE_FN__: (_args) => {
|
|
@@ -425,7 +425,25 @@ function createBridgeComponent(bridgeInfo) {
|
|
|
425
425
|
};
|
|
426
426
|
};
|
|
427
427
|
}
|
|
428
|
+
function createBridgeComponentWithInstance(instance) {
|
|
429
|
+
return (bridgeInfo) => {
|
|
430
|
+
return createBridgeComponent$1({ ...bridgeInfo, instance });
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
let createRemoteComponent;
|
|
434
|
+
let createBridgeComponent;
|
|
435
|
+
function BridgeReactPlugin() {
|
|
436
|
+
return {
|
|
437
|
+
name: "bridge-react-plugin",
|
|
438
|
+
beforeInit(args) {
|
|
439
|
+
createRemoteComponent = createRemoteComponentWithInstance(args.origin);
|
|
440
|
+
createBridgeComponent = createBridgeComponentWithInstance(args.origin);
|
|
441
|
+
return args;
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
}
|
|
428
445
|
export {
|
|
446
|
+
BridgeReactPlugin,
|
|
429
447
|
createBridgeComponent,
|
|
430
448
|
createRemoteComponent
|
|
431
449
|
};
|
package/dist/plugin.d.ts
ADDED
package/dist/router-v6.cjs.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const ReactRouterDom = require("react-router-dom/dist/index.js");
|
|
4
|
+
const ReactRouterDom$1 = require("react-router-dom/dist/index.js");
|
|
5
5
|
const context = require("./context-BcJ-YlNr.cjs");
|
|
6
|
+
const ReactRouterDom = require("react-router-dom/dist/index.js");
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
9
|
if (e) {
|
|
@@ -19,7 +20,7 @@ function _interopNamespaceDefault(e) {
|
|
|
19
20
|
n.default = e;
|
|
20
21
|
return Object.freeze(n);
|
|
21
22
|
}
|
|
22
|
-
const ReactRouterDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDom);
|
|
23
|
+
const ReactRouterDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDom$1);
|
|
23
24
|
function WraperRouter(props) {
|
|
24
25
|
const { basename, ...propsRes } = props;
|
|
25
26
|
const routerContextProps = React.useContext(context.RouterContext) || {};
|
package/dist/router-v6.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare function BrowserRouter(props: Parameters<typeof ReactRouterDom.Br
|
|
|
6
6
|
export declare function RouterProvider(props: Parameters<typeof ReactRouterDom.RouterProvider>[0]): default_2.JSX.Element;
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
export * from "react-router-dom/
|
|
9
|
+
export * from "react-router-dom/";
|
|
10
10
|
|
|
11
11
|
export { }
|
package/dist/router-v6.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useContext } from "react";
|
|
2
|
-
import * as ReactRouterDom from "react-router-dom/dist/index.js";
|
|
3
|
-
export * from "react-router-dom/dist/index.js";
|
|
2
|
+
import * as ReactRouterDom$1 from "react-router-dom/dist/index.js";
|
|
4
3
|
import { R as RouterContext, L as LoggerInstance } from "./context-CUbFnlO5.js";
|
|
4
|
+
export * from "react-router-dom/dist/index.js";
|
|
5
5
|
function WraperRouter(props) {
|
|
6
6
|
const { basename, ...propsRes } = props;
|
|
7
7
|
const routerContextProps = useContext(RouterContext) || {};
|
|
@@ -12,7 +12,7 @@ function WraperRouter(props) {
|
|
|
12
12
|
});
|
|
13
13
|
if (routerContextProps == null ? void 0 : routerContextProps.memoryRoute) {
|
|
14
14
|
return /* @__PURE__ */ React__default.createElement(
|
|
15
|
-
ReactRouterDom.MemoryRouter,
|
|
15
|
+
ReactRouterDom$1.MemoryRouter,
|
|
16
16
|
{
|
|
17
17
|
...props,
|
|
18
18
|
initialEntries: [routerContextProps == null ? void 0 : routerContextProps.memoryRoute.entryPath]
|
|
@@ -20,7 +20,7 @@ function WraperRouter(props) {
|
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
return /* @__PURE__ */ React__default.createElement(
|
|
23
|
-
ReactRouterDom.BrowserRouter,
|
|
23
|
+
ReactRouterDom$1.BrowserRouter,
|
|
24
24
|
{
|
|
25
25
|
...propsRes,
|
|
26
26
|
basename: (routerContextProps == null ? void 0 : routerContextProps.basename) || basename
|
|
@@ -37,9 +37,9 @@ function WraperRouterProvider(props) {
|
|
|
37
37
|
WraperRouterProviderProps: props,
|
|
38
38
|
router
|
|
39
39
|
});
|
|
40
|
-
const RouterProvider = ReactRouterDom["RouterProvider"];
|
|
41
|
-
const createMemoryRouter = ReactRouterDom["createMemoryRouter"];
|
|
42
|
-
const createBrowserRouter = ReactRouterDom["createBrowserRouter"];
|
|
40
|
+
const RouterProvider = ReactRouterDom$1["RouterProvider"];
|
|
41
|
+
const createMemoryRouter = ReactRouterDom$1["createMemoryRouter"];
|
|
42
|
+
const createBrowserRouter = ReactRouterDom$1["createBrowserRouter"];
|
|
43
43
|
if (routerContextProps.memoryRoute) {
|
|
44
44
|
const MemeoryRouterInstance = createMemoryRouter(routers, {
|
|
45
45
|
initialEntries: [routerContextProps == null ? void 0 : routerContextProps.memoryRoute.entryPath]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/bridge-react",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20241119071808",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"import": "./dist/router.es.js",
|
|
27
27
|
"require": "./dist/router.cjs.js"
|
|
28
28
|
},
|
|
29
|
+
"./plugin": {
|
|
30
|
+
"types": "./dist/plugin.d.ts",
|
|
31
|
+
"import": "./dist/plugin.es.js",
|
|
32
|
+
"require": "./dist/plugin.es.js"
|
|
33
|
+
},
|
|
29
34
|
"./router-v5": {
|
|
30
35
|
"types": "./dist/router-v5.d.ts",
|
|
31
36
|
"import": "./dist/router-v5.es.js",
|
|
@@ -41,9 +46,8 @@
|
|
|
41
46
|
"dependencies": {
|
|
42
47
|
"@loadable/component": "^5.16.4",
|
|
43
48
|
"react-error-boundary": "^4.0.13",
|
|
44
|
-
"@module-federation/bridge-shared": "0.0.0-next-
|
|
45
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
46
|
-
"@module-federation/runtime": "0.0.0-next-20241118095355"
|
|
49
|
+
"@module-federation/bridge-shared": "0.0.0-next-20241119071808",
|
|
50
|
+
"@module-federation/sdk": "0.0.0-next-20241119071808"
|
|
47
51
|
},
|
|
48
52
|
"peerDependencies": {
|
|
49
53
|
"react": ">=16.9.0",
|
|
@@ -63,7 +67,8 @@
|
|
|
63
67
|
"react-router-dom": "6.22.3",
|
|
64
68
|
"typescript": "^5.2.2",
|
|
65
69
|
"vite": "^5.2.14",
|
|
66
|
-
"vite-plugin-dts": "^3.9.1"
|
|
70
|
+
"vite-plugin-dts": "^3.9.1",
|
|
71
|
+
"@module-federation/runtime": "0.0.0-next-20241119071808"
|
|
67
72
|
},
|
|
68
73
|
"scripts": {
|
|
69
74
|
"dev": "vite",
|
package/src/create.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
+
import type { FederationHost } from '@module-federation/runtime';
|
|
2
3
|
import {
|
|
3
4
|
ErrorBoundary,
|
|
4
5
|
ErrorBoundaryPropsWithComponent,
|
|
@@ -18,12 +19,17 @@ interface RemoteModule {
|
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
type LazyRemoteComponentInfo<T, E extends keyof T> = {
|
|
22
23
|
loader: () => Promise<T>;
|
|
23
24
|
loading: React.ReactNode;
|
|
24
25
|
fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
|
|
25
26
|
export?: E;
|
|
26
|
-
|
|
27
|
+
instance?: FederationHost;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function createLazyRemoteComponent<T, E extends keyof T>(
|
|
31
|
+
info: LazyRemoteComponentInfo<T, E>,
|
|
32
|
+
) {
|
|
27
33
|
const exportName = info?.export || 'default';
|
|
28
34
|
return React.lazy(async () => {
|
|
29
35
|
LoggerInstance.log(`createRemoteComponent LazyComponent create >>>`, {
|
|
@@ -58,6 +64,7 @@ function createLazyRemoteComponent<T, E extends keyof T>(info: {
|
|
|
58
64
|
exportName={info.export || 'default'}
|
|
59
65
|
fallback={info.fallback}
|
|
60
66
|
ref={ref}
|
|
67
|
+
instance={info.instance}
|
|
61
68
|
{...props}
|
|
62
69
|
/>
|
|
63
70
|
);
|
|
@@ -83,12 +90,9 @@ function createLazyRemoteComponent<T, E extends keyof T>(info: {
|
|
|
83
90
|
});
|
|
84
91
|
}
|
|
85
92
|
|
|
86
|
-
export function createRemoteComponent<T, E extends keyof T>(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
|
|
90
|
-
export?: E;
|
|
91
|
-
}) {
|
|
93
|
+
export function createRemoteComponent<T, E extends keyof T>(
|
|
94
|
+
info: LazyRemoteComponentInfo<T, E>,
|
|
95
|
+
) {
|
|
92
96
|
type ExportType = T[E] extends (...args: any) => any
|
|
93
97
|
? ReturnType<T[E]>
|
|
94
98
|
: never;
|
|
@@ -112,3 +116,13 @@ export function createRemoteComponent<T, E extends keyof T>(info: {
|
|
|
112
116
|
},
|
|
113
117
|
);
|
|
114
118
|
}
|
|
119
|
+
|
|
120
|
+
export function createRemoteComponentWithInstance<T, E extends keyof T>(
|
|
121
|
+
instance: FederationHost,
|
|
122
|
+
) {
|
|
123
|
+
return (info: LazyRemoteComponentInfo<T, E>) => {
|
|
124
|
+
return createLazyRemoteComponent({ ...info, instance });
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type CreateRemoteComponent = typeof createRemoteComponent;
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { FederationRuntimePlugin } from '@module-federation/runtime';
|
|
2
|
+
import { createRemoteComponentWithInstance } from './create';
|
|
3
|
+
import { createBridgeComponentWithInstance } from './provider';
|
|
4
|
+
import type { CreateRemoteComponent } from './create';
|
|
5
|
+
import type { CreateBridgeComponent } from './provider';
|
|
6
|
+
|
|
7
|
+
let createRemoteComponent: CreateRemoteComponent;
|
|
8
|
+
let createBridgeComponent: CreateBridgeComponent;
|
|
9
|
+
function BridgeReactPlugin(): FederationRuntimePlugin {
|
|
10
|
+
return {
|
|
11
|
+
name: 'bridge-react-plugin',
|
|
12
|
+
beforeInit(args) {
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
createRemoteComponent = createRemoteComponentWithInstance(args.origin);
|
|
15
|
+
createBridgeComponent = createBridgeComponentWithInstance(args.origin);
|
|
16
|
+
return args;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { BridgeReactPlugin, createRemoteComponent, createBridgeComponent };
|
|
3
22
|
export type {
|
|
4
23
|
ProviderParams,
|
|
5
24
|
RenderFnParams,
|
package/src/plugin.ts
ADDED
package/src/provider.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
10
|
import { RouterContext } from './context';
|
|
11
11
|
import { LoggerInstance, atLeastReact18 } from './utils';
|
|
12
|
-
import {
|
|
12
|
+
import type { FederationHost } from '@module-federation/runtime';
|
|
13
13
|
|
|
14
14
|
type RenderParams = RenderFnParams & {
|
|
15
15
|
[key: string]: unknown;
|
|
@@ -26,13 +26,17 @@ type ProviderFnParams<T> = {
|
|
|
26
26
|
App: React.ReactElement,
|
|
27
27
|
id?: HTMLElement | string,
|
|
28
28
|
) => RootType | Promise<RootType>;
|
|
29
|
+
instance?: FederationHost;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export function createBridgeComponent<T>(bridgeInfo: ProviderFnParams<T>) {
|
|
32
33
|
return () => {
|
|
33
34
|
const rootMap = new Map<any, RootType>();
|
|
34
|
-
const instance =
|
|
35
|
-
LoggerInstance.log(
|
|
35
|
+
const { instance } = bridgeInfo;
|
|
36
|
+
LoggerInstance.log(
|
|
37
|
+
`createBridgeComponent instance from props >>>`,
|
|
38
|
+
instance,
|
|
39
|
+
);
|
|
36
40
|
|
|
37
41
|
const RawComponent = (info: { propsInfo: T; appInfo: ProviderParams }) => {
|
|
38
42
|
const { appInfo, propsInfo, ...restProps } = info;
|
|
@@ -95,7 +99,6 @@ export function createBridgeComponent<T>(bridgeInfo: ProviderFnParams<T>) {
|
|
|
95
99
|
const renderFn = bridgeInfo?.render || ReactDOM.render;
|
|
96
100
|
renderFn?.(rootComponentWithErrorBoundary, info.dom);
|
|
97
101
|
}
|
|
98
|
-
|
|
99
102
|
instance?.bridgeHook?.lifecycle?.afterBridgeRender?.emit(info) || {};
|
|
100
103
|
},
|
|
101
104
|
|
|
@@ -103,7 +106,6 @@ export function createBridgeComponent<T>(bridgeInfo: ProviderFnParams<T>) {
|
|
|
103
106
|
LoggerInstance.log(`createBridgeComponent destroy Info`, {
|
|
104
107
|
dom: info.dom,
|
|
105
108
|
});
|
|
106
|
-
|
|
107
109
|
instance?.bridgeHook?.lifecycle?.beforeBridgeDestroy?.emit(info);
|
|
108
110
|
|
|
109
111
|
// call destroy function
|
|
@@ -115,7 +117,9 @@ export function createBridgeComponent<T>(bridgeInfo: ProviderFnParams<T>) {
|
|
|
115
117
|
ReactDOM.unmountComponentAtNode(info.dom);
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
instance?.bridgeHook?.lifecycle?.afterBridgeDestroy?.emit(
|
|
120
|
+
(instance as any)?.bridgeHook?.lifecycle?.afterBridgeDestroy?.emit(
|
|
121
|
+
info,
|
|
122
|
+
);
|
|
119
123
|
},
|
|
120
124
|
rawComponent: bridgeInfo.rootComponent,
|
|
121
125
|
__BRIDGE_FN__: (_args: T) => {},
|
|
@@ -130,3 +134,11 @@ export function ShadowRoot(info: { children: () => JSX.Element }) {
|
|
|
130
134
|
|
|
131
135
|
return <div ref={domRef}>{root && <info.children />}</div>;
|
|
132
136
|
}
|
|
137
|
+
|
|
138
|
+
export function createBridgeComponentWithInstance<T>(instance: FederationHost) {
|
|
139
|
+
return (bridgeInfo: ProviderFnParams<T>) => {
|
|
140
|
+
return createBridgeComponent({ ...bridgeInfo, instance });
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type CreateBridgeComponent = typeof createBridgeComponent;
|
package/src/remote/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import type { ProviderParams } from '@module-federation/bridge-shared';
|
|
|
10
10
|
import { dispatchPopstateEnv } from '@module-federation/bridge-shared';
|
|
11
11
|
import { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
|
|
12
12
|
import { LoggerInstance, pathJoin, getRootDomDefaultClassName } from '../utils';
|
|
13
|
-
import {
|
|
13
|
+
import type { FederationHost } from '@module-federation/runtime';
|
|
14
14
|
|
|
15
15
|
declare const __APP_VERSION__: string;
|
|
16
16
|
export interface RenderFnParams extends ProviderParams {
|
|
@@ -34,6 +34,7 @@ interface RemoteAppParams {
|
|
|
34
34
|
providerInfo: NonNullable<RemoteModule['provider']>;
|
|
35
35
|
exportName: string | number | symbol;
|
|
36
36
|
fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
|
|
37
|
+
instance: FederationHost;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
const RemoteAppWrapper = forwardRef(function (
|
|
@@ -50,6 +51,7 @@ const RemoteAppWrapper = forwardRef(function (
|
|
|
50
51
|
className,
|
|
51
52
|
style,
|
|
52
53
|
fallback,
|
|
54
|
+
instance,
|
|
53
55
|
...resProps
|
|
54
56
|
} = props;
|
|
55
57
|
|
|
@@ -60,8 +62,7 @@ const RemoteAppWrapper = forwardRef(function (
|
|
|
60
62
|
|
|
61
63
|
const renderDom: React.MutableRefObject<HTMLElement | null> = useRef(null);
|
|
62
64
|
const providerInfoRef = useRef<any>(null);
|
|
63
|
-
|
|
64
|
-
LoggerInstance.log(`RemoteAppWrapper hostInstance >>>`, hostInstance);
|
|
65
|
+
LoggerInstance.log(`RemoteAppWrapper instance from props >>>`, instance);
|
|
65
66
|
|
|
66
67
|
useEffect(() => {
|
|
67
68
|
const renderTimeout = setTimeout(() => {
|
|
@@ -84,18 +85,16 @@ const RemoteAppWrapper = forwardRef(function (
|
|
|
84
85
|
|
|
85
86
|
LoggerInstance.log(
|
|
86
87
|
`createRemoteComponent LazyComponent hostInstance >>>`,
|
|
87
|
-
|
|
88
|
+
instance,
|
|
88
89
|
);
|
|
89
90
|
const beforeBridgeRenderRes =
|
|
90
|
-
|
|
91
|
+
instance?.bridgeHook?.lifecycle?.beforeBridgeRender?.emit(
|
|
91
92
|
renderProps,
|
|
92
93
|
) || {};
|
|
93
94
|
// @ts-ignore
|
|
94
95
|
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
|
|
95
96
|
providerReturn.render(renderProps);
|
|
96
|
-
|
|
97
|
-
renderProps,
|
|
98
|
-
);
|
|
97
|
+
instance?.bridgeHook?.lifecycle?.afterBridgeRender?.emit(renderProps);
|
|
99
98
|
});
|
|
100
99
|
|
|
101
100
|
return () => {
|
|
@@ -107,7 +106,7 @@ const RemoteAppWrapper = forwardRef(function (
|
|
|
107
106
|
{ moduleName, basename, dom: renderDom.current },
|
|
108
107
|
);
|
|
109
108
|
|
|
110
|
-
|
|
109
|
+
instance?.bridgeHook?.lifecycle?.beforeBridgeDestroy?.emit({
|
|
111
110
|
moduleName,
|
|
112
111
|
dom: renderDom.current,
|
|
113
112
|
basename,
|
|
@@ -121,7 +120,7 @@ const RemoteAppWrapper = forwardRef(function (
|
|
|
121
120
|
dom: renderDom.current,
|
|
122
121
|
});
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
instance?.bridgeHook?.lifecycle?.afterBridgeDestroy?.emit({
|
|
125
124
|
moduleName,
|
|
126
125
|
dom: renderDom.current,
|
|
127
126
|
basename,
|
package/src/router-v5.tsx
CHANGED
|
@@ -36,7 +36,7 @@ function WraperRouter(
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// @ts-ignore
|
|
39
|
-
//
|
|
39
|
+
// because export directly from react-router-dom/index.js will cause build falied.
|
|
40
40
|
// it will be replace by react-router-dom/index.js in building phase
|
|
41
41
|
export * from 'react-router-dom/';
|
|
42
42
|
|
package/src/router-v6.tsx
CHANGED
|
@@ -69,6 +69,7 @@ function WraperRouterProvider(
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export * from 'react-router-dom/dist/index.js';
|
|
72
|
+
// export * from 'react-router-dom/dist/index.js';
|
|
73
|
+
export * from 'react-router-dom/';
|
|
73
74
|
export { WraperRouter as BrowserRouter };
|
|
74
75
|
export { WraperRouterProvider as RouterProvider };
|
package/src/utils.ts
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
|
-
import vue from '@vitejs/plugin-vue';
|
|
2
|
+
// import vue from '@vitejs/plugin-vue';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import dts from 'vite-plugin-dts';
|
|
5
|
-
import react from '@vitejs/plugin-react';
|
|
5
|
+
// import react from '@vitejs/plugin-react';
|
|
6
6
|
import packageJson from './package.json';
|
|
7
7
|
|
|
8
8
|
const perDepsKeys = Object.keys(packageJson.peerDependencies);
|
|
@@ -21,6 +21,7 @@ export default defineConfig({
|
|
|
21
21
|
lib: {
|
|
22
22
|
entry: {
|
|
23
23
|
index: path.resolve(__dirname, 'src/index.ts'),
|
|
24
|
+
plugin: path.resolve(__dirname, 'src/plugin.ts'),
|
|
24
25
|
router: path.resolve(__dirname, 'src/router.tsx'),
|
|
25
26
|
'router-v5': path.resolve(__dirname, 'src/router-v5.tsx'),
|
|
26
27
|
'router-v6': path.resolve(__dirname, 'src/router-v6.tsx'),
|
|
@@ -36,7 +37,6 @@ export default defineConfig({
|
|
|
36
37
|
'react-router-dom/',
|
|
37
38
|
'react-router-dom/index.js',
|
|
38
39
|
'react-router-dom/dist/index.js',
|
|
39
|
-
'@module-federation/runtime',
|
|
40
40
|
],
|
|
41
41
|
plugins: [
|
|
42
42
|
{
|
|
@@ -44,13 +44,13 @@ export default defineConfig({
|
|
|
44
44
|
generateBundle(options, bundle) {
|
|
45
45
|
for (const fileName in bundle) {
|
|
46
46
|
const chunk = bundle[fileName];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
if (fileName.includes('router-v6') && chunk.type === 'chunk') {
|
|
48
|
+
chunk.code = chunk.code.replace(
|
|
49
|
+
// Match 'react-router-dom/' followed by single quotes, double quotes, or backticks, replacing only 'react-router-dom/' to react-router-v6 dist file structure
|
|
50
|
+
/react-router-dom\/(?=[\'\"\`])/g,
|
|
51
|
+
'react-router-dom/dist/index.js',
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
54
|
|
|
55
55
|
if (fileName.includes('router-v5') && chunk.type === 'chunk') {
|
|
56
56
|
chunk.code = chunk.code.replace(
|