-
-
Save kziemski/4e60d64937df2f8db7968439e60f499d to your computer and use it in GitHub Desktop.
Revisions
-
marcosmapf renamed this gist
Aug 10, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
marcosmapf created this gist
Aug 10, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ import React, { lazy, Suspense } from 'react' import { render } from 'react-dom' import { initRequestConfiguration } from 'utils/request' import { createShadowDom, initializeTagManager, setLocales, setToken } from 'startup/utils' import handleFederatedApp from 'utils/federatedApp' import 'config/requestRegister' const App = lazy(() => import('startup/umd/app')) const Root = () => { return ( <div id={process.env.PROJECT_NAME}> <Suspense fallback={null}> <App /> </Suspense> </div> ) } const renderApp = async (rootElement: any, { baseUrl = '/', lang, token }) => { // eslint-disable-next-line camelcase __webpack_public_path__ = baseUrl const { setAppRoot } = handleFederatedApp() const shadowRoot = createShadowDom(rootElement) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion setAppRoot(process.env.PROJECT_NAME!, shadowRoot) if (!token) { throw new Error('Missing valid token param') } await setLocales(lang) setToken(token) initRequestConfiguration(token) initializeTagManager() render(<Root />, shadowRoot) } export default renderApp