@module-federation/modern-js 0.0.0-next-20240528093255 → 0.0.0-next-20240528100448

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.
@@ -114,9 +114,15 @@ function MFReactComponent(props) {
114
114
  if (!fallback) {
115
115
  throw err;
116
116
  }
117
- const FallbackComponent = typeof fallback === "function" ? fallback(err) : fallback;
117
+ const FallbackNode = typeof fallback === "function" ? fallback(err) : fallback;
118
+ if (/* @__PURE__ */ import_react.default.isValidElement(FallbackNode)) {
119
+ return {
120
+ default: () => FallbackNode
121
+ };
122
+ }
123
+ const FallbackFunctionComponent = FallbackNode;
118
124
  return {
119
- default: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackComponent, {})
125
+ default: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackFunctionComponent, {})
120
126
  };
121
127
  }));
122
128
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Suspense, {
@@ -84,10 +84,18 @@ function MFReactComponent(props) {
84
84
  if (!fallback) {
85
85
  throw err;
86
86
  }
87
- var FallbackComponent = typeof fallback === "function" ? fallback(err) : fallback;
87
+ var FallbackNode = typeof fallback === "function" ? fallback(err) : fallback;
88
+ if (/* @__PURE__ */ React.isValidElement(FallbackNode)) {
89
+ return {
90
+ default: function() {
91
+ return FallbackNode;
92
+ }
93
+ };
94
+ }
95
+ var FallbackFunctionComponent = FallbackNode;
88
96
  return {
89
97
  default: function() {
90
- return /* @__PURE__ */ _jsx(FallbackComponent, {});
98
+ return /* @__PURE__ */ _jsx(FallbackFunctionComponent, {});
91
99
  }
92
100
  };
93
101
  });
@@ -80,9 +80,15 @@ function MFReactComponent(props) {
80
80
  if (!fallback) {
81
81
  throw err;
82
82
  }
83
- const FallbackComponent = typeof fallback === "function" ? fallback(err) : fallback;
83
+ const FallbackNode = typeof fallback === "function" ? fallback(err) : fallback;
84
+ if (/* @__PURE__ */ React.isValidElement(FallbackNode)) {
85
+ return {
86
+ default: () => FallbackNode
87
+ };
88
+ }
89
+ const FallbackFunctionComponent = FallbackNode;
84
90
  return {
85
- default: () => /* @__PURE__ */ _jsx(FallbackComponent, {})
91
+ default: () => /* @__PURE__ */ _jsx(FallbackFunctionComponent, {})
86
92
  };
87
93
  }));
88
94
  return /* @__PURE__ */ _jsx(React.Suspense, {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  interface IProps {
3
3
  id: string;
4
4
  loading?: React.ReactNode;
5
- fallback?: (err: Error) => React.FC | React.FC;
5
+ fallback?: ((err: Error) => React.FC | React.ReactElement) | React.FC | React.ReactElement;
6
6
  }
7
7
  declare function collectLinks(id: string): React.ReactNode[];
8
8
  declare function MFReactComponent(props: IProps): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.0.0-next-20240528093255",
3
+ "version": "0.0.0-next-20240528100448",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -46,10 +46,10 @@
46
46
  "@modern-js/utils": "^2.49.2",
47
47
  "@modern-js/node-bundle-require": "^2.49.2",
48
48
  "node-fetch": "~3.3.0",
49
- "@module-federation/sdk": "0.0.0-next-20240528093255",
50
- "@module-federation/enhanced": "0.0.0-next-20240528093255",
51
- "@module-federation/node": "0.0.0-next-20240528093255",
52
- "@module-federation/dts-plugin": "0.0.0-next-20240528093255"
49
+ "@module-federation/sdk": "0.0.0-next-20240528100448",
50
+ "@module-federation/enhanced": "0.0.0-next-20240528100448",
51
+ "@module-federation/node": "0.0.0-next-20240528100448",
52
+ "@module-federation/dts-plugin": "0.0.0-next-20240528100448"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@modern-js/app-tools": "^2.49.2",
@@ -57,7 +57,7 @@
57
57
  "@modern-js/runtime": "^2.49.2",
58
58
  "@modern-js/module-tools": "^2.35.0",
59
59
  "@modern-js/tsconfig": "^2.35.0",
60
- "@module-federation/manifest": "0.0.0-next-20240528093255"
60
+ "@module-federation/manifest": "0.0.0-next-20240528100448"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react": ">=17",