You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uim3.5升级到umi4.3 路由渲染页面报错:Element type is invalid. Received a promise that resolves to: [object Object]. Lazy element type must resolve to a class or function.
#12811
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
开发环境:
"@umijs/max": "^4.3.35",
"@types/react": "^18.3.0",
"@ant-design/pro-components": "2.7.19",
config/config.js 文件配置项
export default defineConfig({ hash: true, targets: { ie: 11, }, routes, theme: { 'root-entry-name': 'variable', }, ignoreMomentLocale: true, fastRefresh: true, model: {}, initialState: {}, title: '系统', layout: { locale: true, ...defaultSettings, }, request: {}, access: {}, presets: ['umi-presets-pro'], esbuildMinifyIIFE: true, requestRecord: {}, keepalive: [/./], tabsLayout: {}, });
app.js layout配置
export const layout = () => { return { avatarProps: {...}, route: { routes: [ { name: "首页", icon: <SmileOutlined />, component: "./Welcome", path: "/welcome", }, ], }, childrenRender: (children) => { // if (initialState?.loading) return <PageLoading />; return ( <> {children} 如果这里直接写<div>2234</div>就可以正常渲染出2234,用children就报错 </> ); }, } }
报错如图:
Beta Was this translation helpful? Give feedback.
All reactions