Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel 无法识别导出的类型定义 #4042

Closed
xiaohuoni opened this issue Mar 3, 2020 · 4 comments
Closed

babel 无法识别导出的类型定义 #4042

xiaohuoni opened this issue Mar 3, 2020 · 4 comments
Assignees

Comments

@xiaohuoni
Copy link
Member

What happens?

image

api.addUmiExports(() => [
    {
      specifiers: ['Reducer'],
      source: 'redux',
    },
  ]);

通过 api.addUmiExports 添加导出,比如上面的 Reducer 是一个 type ,在编译的时候就会提示无法找到 "export 'Reducer' was not found in 'redux',看是不是能先关掉 warning 日志。

尝试修复

通过升级 typescript 版本,使用最新的语法。

export type { Reducer  } from 'redux';

发现 babel 还没有支持。
image

相关环境信息

  • Umi 版本:3.0.1
  • Node 版本:10.13.0
  • 操作系统:mac
@sorrycc
Copy link
Member

sorrycc commented Mar 4, 2020

babel/babel#11171

@sorrycc
Copy link
Member

sorrycc commented Mar 4, 2020

Wait for babel@7.9 .

@xiaohuoni
Copy link
Member Author

我的临时的解决方案是将

import { IndexModelState } from './index';
import { SettingsModelState } from './settings';
import { ListModelState } from './list';
export { ListModelState, SettingsModelState, IndexModelState };

修改为

export * from './index';
export * from './settings';
export * from './list';

@xiaohuoni
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants