新建项目 umirc.ts 中开启 layout:{}
控制台启动后会抛出很多警告,但是能正常使用
WARNING Compiled with 8 warnings 19:49:43
warning in ./src/.umi/plugin-layout/layout/layout/renderRightContent.tsx
"export 'SelectLang' was not found in 'umi'
warning in ./src/.umi/plugin-layout/layout/layout/renderRightContent.tsx
"export 'SelectLang' was not found in 'umi'
warning in ./src/.umi/plugin-layout/layout/utils/intl.ts
"export 'getLocale' was not found in 'umi'
warning in ./src/.umi/plugin-layout/layout/layout/index.tsx
"export 'useIntl' was not found in 'umi'
warning in ./src/.umi/plugin-layout/layout/layout/index.tsx
"export 'useIntl' was not found in 'umi'
warning in ./src/.umi/plugin-layout/layout/utils/intl.ts
"export 'useIntl' was not found in 'umi'
去除掉这些不影响结果的警告消息
貌似是默认开启了多语言的功能,然后又没有相应的配置,感觉像是布局插件的问题

@gujintao1900

是有的,但是还是有提示

我是第一次使用umi,我按照官网的快速上手来走一遍,也发现了这个问题,另外 @ant-design/pro-layout 好像是一开始就有的,并不需要自己再去安装。这初体验确实太影响第一印象了。
我的解决办法是增加: locale: {}
// .umirc.ts
export default defineConfig({
...
layout: {
locale: false,
},
locale: {},
})
Most helpful comment
我的解决办法是增加:
locale: {}