@ttk/micro-frontend-react
Advanced tools
+10
-12
| (function (global, factory) { | ||
| typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('qiankun'), require('react-dom')) : | ||
| typeof define === 'function' && define.amd ? define(['exports', 'react', 'qiankun', 'react-dom'], factory) : | ||
| (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ttk_mf_react = {}, global.react, global.qiankun, global.ReactDOM)); | ||
| }(this, (function (exports, React, qiankun, ReactDOM) { 'use strict'; | ||
| typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@ttk/micro-frontend-qiankun'), require('react-dom')) : | ||
| typeof define === 'function' && define.amd ? define(['exports', 'react', '@ttk/micro-frontend-qiankun', 'react-dom'], factory) : | ||
| (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ttk_mf_react = {}, global.react, global.ttkQiankun, global.ReactDOM)); | ||
| }(this, (function (exports, React, microFrontendQiankun, ReactDOM) { 'use strict'; | ||
@@ -96,3 +96,2 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
| RenderError = mfAppConfig.renderError; | ||
| console.log('mount startAppName', startAppName); | ||
@@ -133,3 +132,3 @@ var _useState = React.useState(true), | ||
| qiankun.addGlobalUncaughtErrorHandler(errorHandler); | ||
| microFrontendQiankun.addGlobalUncaughtErrorHandler(errorHandler); | ||
| var configuration = { | ||
@@ -143,3 +142,3 @@ sandbox: { | ||
| if (!appRef.current) { | ||
| appRef.current = qiankun.loadMicroApp({ | ||
| appRef.current = microFrontendQiankun.loadMicroApp({ | ||
| name: name, | ||
@@ -173,5 +172,4 @@ entry: entry, | ||
| console.log('unmount startAppName', startAppName); | ||
| (_appRef$current = appRef.current) == null ? void 0 : _appRef$current.safeUnmount(); | ||
| qiankun.removeGlobalUncaughtErrorHandler(errorHandler); | ||
| microFrontendQiankun.removeGlobalUncaughtErrorHandler(errorHandler); | ||
| }; | ||
@@ -198,3 +196,3 @@ }, [mfAppConfig, delayLoad]); | ||
| var actions = qiankun.initGlobalState({ | ||
| var actions = microFrontendQiankun.initGlobalState({ | ||
| // 所有app资源加载状态 | ||
@@ -223,3 +221,3 @@ hasAppLoading: false, | ||
| // 第一个app未挂载,则监听微应用生命周期 | ||
| qiankun.runAfterFirstMounted(function () { | ||
| microFrontendQiankun.runAfterFirstMounted(function () { | ||
| actions.setGlobalState({ | ||
@@ -285,3 +283,3 @@ hasAppLoading: false, | ||
| Root = props.render; | ||
| console.log("[" + packageName + "] app mounted. startAppName:", startAppName, props); | ||
| console.log("[" + packageName + "] app mounted. startAppName:", startAppName); | ||
| ReactDOM__default['default'].render( /*#__PURE__*/React__default['default'].createElement(Root, { | ||
@@ -288,0 +286,0 @@ startAppName: startAppName, |
+2
-4
| import React, { useState, useRef, useCallback, useEffect } from 'react'; | ||
| import { addGlobalUncaughtErrorHandler, loadMicroApp, removeGlobalUncaughtErrorHandler, initGlobalState, runAfterFirstMounted } from 'qiankun'; | ||
| import { addGlobalUncaughtErrorHandler, loadMicroApp, removeGlobalUncaughtErrorHandler, initGlobalState, runAfterFirstMounted } from '@ttk/micro-frontend-qiankun'; | ||
| import ReactDOM from 'react-dom'; | ||
@@ -89,3 +89,2 @@ | ||
| RenderError = mfAppConfig.renderError; | ||
| console.log('mount startAppName', startAppName); | ||
@@ -164,3 +163,2 @@ var _useState = useState(true), | ||
| console.log('unmount startAppName', startAppName); | ||
| (_appRef$current = appRef.current) == null ? void 0 : _appRef$current.safeUnmount(); | ||
@@ -274,3 +272,3 @@ removeGlobalUncaughtErrorHandler(errorHandler); | ||
| Root = props.render; | ||
| console.log("[" + packageName + "] app mounted. startAppName:", startAppName, props); | ||
| console.log("[" + packageName + "] app mounted. startAppName:", startAppName); | ||
| ReactDOM.render( /*#__PURE__*/React.createElement(Root, { | ||
@@ -277,0 +275,0 @@ startAppName: startAppName, |
+7
-9
@@ -6,3 +6,3 @@ 'use strict'; | ||
| var React = require('react'); | ||
| var qiankun = require('qiankun'); | ||
| var microFrontendQiankun = require('@ttk/micro-frontend-qiankun'); | ||
| var ReactDOM = require('react-dom'); | ||
@@ -99,3 +99,2 @@ | ||
| RenderError = mfAppConfig.renderError; | ||
| console.log('mount startAppName', startAppName); | ||
@@ -136,3 +135,3 @@ var _useState = React.useState(true), | ||
| qiankun.addGlobalUncaughtErrorHandler(errorHandler); | ||
| microFrontendQiankun.addGlobalUncaughtErrorHandler(errorHandler); | ||
| var configuration = { | ||
@@ -146,3 +145,3 @@ sandbox: { | ||
| if (!appRef.current) { | ||
| appRef.current = qiankun.loadMicroApp({ | ||
| appRef.current = microFrontendQiankun.loadMicroApp({ | ||
| name: name, | ||
@@ -176,5 +175,4 @@ entry: entry, | ||
| console.log('unmount startAppName', startAppName); | ||
| (_appRef$current = appRef.current) == null ? void 0 : _appRef$current.safeUnmount(); | ||
| qiankun.removeGlobalUncaughtErrorHandler(errorHandler); | ||
| microFrontendQiankun.removeGlobalUncaughtErrorHandler(errorHandler); | ||
| }; | ||
@@ -201,3 +199,3 @@ }, [mfAppConfig, delayLoad]); | ||
| var actions = qiankun.initGlobalState({ | ||
| var actions = microFrontendQiankun.initGlobalState({ | ||
| // 所有app资源加载状态 | ||
@@ -226,3 +224,3 @@ hasAppLoading: false, | ||
| // 第一个app未挂载,则监听微应用生命周期 | ||
| qiankun.runAfterFirstMounted(function () { | ||
| microFrontendQiankun.runAfterFirstMounted(function () { | ||
| actions.setGlobalState({ | ||
@@ -288,3 +286,3 @@ hasAppLoading: false, | ||
| Root = props.render; | ||
| console.log("[" + packageName + "] app mounted. startAppName:", startAppName, props); | ||
| console.log("[" + packageName + "] app mounted. startAppName:", startAppName); | ||
| ReactDOM__default['default'].render( /*#__PURE__*/React__default['default'].createElement(Root, { | ||
@@ -291,0 +289,0 @@ startAppName: startAppName, |
+2
-2
| { | ||
| "name": "@ttk/micro-frontend-react", | ||
| "version": "0.0.4", | ||
| "version": "0.0.5", | ||
| "description": "ttk微前端react", | ||
@@ -15,3 +15,3 @@ "main": "./lib/index.js", | ||
| "test": "echo \"Error: no test specified\" && exit 1", | ||
| "build": "rollup -c && cp -R es/index.js /Users/lztccol/FxProject/gitlab/src/ttk/website/node_modules/@ttk/micro-frontend-react/es" | ||
| "build": "rollup -c" | ||
| }, | ||
@@ -18,0 +18,0 @@ "keywords": [ |
56301
-0.39%1122
-0.53%