@lemon-fe/vite-plugin-micro-frontend 1.0.9 → 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/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +4 -3
- package/dist/runtime.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime.d.ts
CHANGED
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { createElement, Suspense,
|
|
1
|
+
import require$$0, { lazy, createElement, Suspense, Component } from 'react';
|
|
2
2
|
import { qiankunWindow as qiankunWindow$1, renderWithQiankun as renderWithQiankun$1 } from 'vite-plugin-qiankun/es/helper';
|
|
3
3
|
|
|
4
4
|
function getDefaultExportFromCjs (x) {
|
|
@@ -27877,15 +27877,16 @@ class DynamicErrorBoundary extends Component {
|
|
|
27877
27877
|
}
|
|
27878
27878
|
/**
|
|
27879
27879
|
* 封装动态导入函数,兼容 Umi 的 dynamic
|
|
27880
|
-
*
|
|
27881
27880
|
*/
|
|
27882
27881
|
function dynamic(options) {
|
|
27882
|
+
// lazy 在外层调用,只创建一次,保证组件引用稳定(keepAlive 依赖此特性)
|
|
27883
|
+
const LazyComponent = lazy(options.loader);
|
|
27883
27884
|
const LoadingComponent = options.loading;
|
|
27884
27885
|
return function DynamicComponent(props) {
|
|
27885
27886
|
const loadingElement = LoadingComponent
|
|
27886
27887
|
? createElement(LoadingComponent)
|
|
27887
27888
|
: null;
|
|
27888
|
-
return createElement(DynamicErrorBoundary, { LoadingComponent }, createElement(Suspense, { fallback: loadingElement }, createElement(
|
|
27889
|
+
return createElement(DynamicErrorBoundary, { LoadingComponent }, createElement(Suspense, { fallback: loadingElement }, createElement(LazyComponent, props)));
|
|
27889
27890
|
};
|
|
27890
27891
|
}
|
|
27891
27892
|
|