import { RuntimeContext } from '@modern-js/runtime-core' ; import { renderToStaticMarkup } from 'react-dom/server' ; import { run } from './hook' ; const prefetch = async ( App , context ) => run ( context . ssrContext . request . headers , async ( ) => { renderToStaticMarkup ( < App context = { context } / > ) ; if ( ! context . loaderManager . hasPendingLoaders ( ) ) { return { i18nData : context . __i18nData__ , } ; } const loadersData = await context . loaderManager . awaitPendingLoaders ( ) ; return { loadersData , i18nData : context . __i18nData__ , storeState : context ?. store ?. getState ( ) , } ; } ) ; export default prefetch ;