We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在 build-scripts 配置的组件库项目中,源码中 import { ConfigProvider } from '@alifd/next';
然后构建,在 lib 和 es 输出中,ConfigProvider 的导入都丢失了,其他导入正常。在应用中引用这个包报错。
ConfigProvider 编译后能被正常导入
{ "plugins": [ "build-plugin-component", [ "build-plugin-moment-locales", { "locales": ["zh-cn"] } ] ], "library": "BcOtFetch", "libraryTarget": "umd", "filename": "index", "minify": true, "externals": { "react": "React", "react-dom": "ReactDOM", "@alifd/next": "Next", "moment": "moment" } }
The text was updated successfully, but these errors were encountered:
这个 ConfigProvider 我们并没有当 React 组件来使用,而是当作类来使用它的一些静态方法/变量。我尝试手动加了一行 JSX
import 就回来了。看来是 build-scripts 用了什么算法,只导入 JSX?
Sorry, something went wrong.
经分析,代码中 ConfigProvider 的用法如下:
import { ConfigProvider } from '@alifd/next'; (ConfigProvider as any).getLanguage();
babel-plugin-import 不会处理 typescript as 语法,从而无法未能正确处理 ConfigProvider 的按需逻辑。相关 issue
babel-plugin-import
as
ConfigProvider
disableGenerateStyle: true
这个问题暂时不再跟进。
maoxiaoke
No branches or pull requests
What is the current behavior? 发生了什么?
在 build-scripts 配置的组件库项目中,源码中 import { ConfigProvider } from '@alifd/next';
然后构建,在 lib 和 es 输出中,ConfigProvider 的导入都丢失了,其他导入正常。在应用中引用这个包报错。
What is the expected behavior? 期望的结果是什么?
ConfigProvider 编译后能被正常导入
Any additional comments? 相关环境信息?
The text was updated successfully, but these errors were encountered: