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
当前 package.json 中声明的导出方式,无法显示自动根据环境切换 CommonJS 和 ESModule 导入, 我发现有一些依赖此包的代码,直接使用如 import warn from 'rc-util/lib/warning'; 的方式导入,这会导致导入的代码永远是 CommonJS 格式的。
import warn from 'rc-util/lib/warning';
如下面的代码: https://github.com/ant-design/ant-design-icons/blob/77062f82563607540029c31be00f22bf2359a72e/packages/icons-react/src/utils.ts#L3-L5
正确的导出方式应该是使用 exports 导出,并在使用时使用 rc-util/warning 来导入。
rc-util/warning
"exports": { ".": { "import": "./es/index.js", "require": "./lib/index.js", "types": "./es/index.d.ts" }, "./*": { "import": "./es/*.js", "require": "./lib/*.js", "types": "./es/*.d.ts" }, "./Children/*": { "import": "./es/Children/*.js", "require": "./lib/Children/*.js", "types": "./es/Children/*.d.ts" }, "./debug/*": { "import": "./es/debug/*.js", "require": "./lib/debug/*.js", "types": "./es/debug/*.d.ts" }, "./Dom/*": { "import": "./es/Dom/*.js", "require": "./lib/Dom/*.js", "types": "./es/Dom/*.d.ts" }, "./hooks/*": { "import": "./es/hooks/*.js", "require": "./lib/hooks/*.js", "types": "./es/hooks/*.d.ts" }, "./React/*": { "import": "./es/React/*.js", "require": "./lib/React/*.js", "types": "./es/React/*.d.ts" }, "./utils/*": { "import": "./es/utils/*.js", "require": "./lib/utils/*.js", "types": "./es/utils/*.d.ts" } },
这是一项破坏性的修改,会导致其他错误导入此包的代码无法使用。
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
当前 package.json 中声明的导出方式,无法显示自动根据环境切换 CommonJS 和 ESModule 导入,
我发现有一些依赖此包的代码,直接使用如
import warn from 'rc-util/lib/warning';
的方式导入,这会导致导入的代码永远是 CommonJS 格式的。如下面的代码:
https://github.com/ant-design/ant-design-icons/blob/77062f82563607540029c31be00f22bf2359a72e/packages/icons-react/src/utils.ts#L3-L5
正确的导出方式应该是使用 exports 导出,并在使用时使用
rc-util/warning
来导入。其他
这是一项破坏性的修改,会导致其他错误导入此包的代码无法使用。
相关 Issues
The text was updated successfully, but these errors were encountered: