-
Notifications
You must be signed in to change notification settings - Fork 584
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
Missing support for type: "module" on Node? #605
Comments
This seems to be a regression from 5.1.4 to 5.2.0 |
@hannesj You are right, downgrading to 5.1.4 from 5.2.6 makes it work. The issue seems to be that the CJS code (
Regarding option 2.: Node is currently always going to import the CJS
Maybe this also works without |
To make it work with 5.2.6 and Remix 2+ I also found a possible workaround to be adding dependencies to
This basically just compiles the packages into the resulting |
And this is now a problem with Remix 2.3.0 because the |
I can't switch to vite yet because of other bugs, but would |
此问题从 5.2.x 开始出现,代码的导出方式发生了变化, 这使得原先不需要编译,通过 只能暂时锁定在 5.1版本规避,受此影响项目的 由于涉及到打包逻辑,普通人的PR估计你们也不会接受,请求官方跟进这个问题。 相关问题:#307 This problem started in 5.2.x, the code exports changed, and the code under the This makes code that was previously run directly with It can only be temporarily locked in version 5.1 to avoid it, and the As it involves bundle logic, I don't think you'll accept PR for ordinary people, please official follow-up on this issue. Related issues:#307 |
PR is welcome~ |
After I tried hard to bypass the |
After trying I'm sure I can't fix this by myself. Hopefully the official fix will come soon. 🙏 |
npm install @ant-design/web3-wagmi wagmi viem @tanstack/react-query --save |
We get this issue when we upgrade our Refine package (using Next.js) and it tries to use the latest and icons version. On older versions it locked the icons version to 5.0.1, which is under the breaking version of >5.1.4. 😞 |
Hi. Are you fixed it ? |
Experiencing the same, any fix? |
|
Encountered same problem with remix + vite. Wondering how to workaround it. |
Rolling back to |
Note a possible side effect of rolling this back is another issue as mentioned in ant-design/ant-design#47886 which can be mitigated by forcing an older version of react types ant-design/ant-design#47886 (comment) |
Fixed in |
I am trying to import icons from within a Node package with
type: "module"
specified inpackage.json
:Unfortunately, this leads to the following error:
Even
import { BookOutlined } from '@ant-design/icons/es/index.js'
does not work, because the package is interpreted as containing CommonJS modules.The proposed solution is clumsy and also seems to break tree-shaking. My current workaround for each icon that I use is:
This is obviously not a good solution.
@ant-design/icons
should probably be built usingtype: "module"
, specify anexports
field inpackage.json
and use imports with file extensions in the build.The text was updated successfully, but these errors were encountered: