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

fix: import bug in server (next.js/remix/bun) #653

Merged
merged 3 commits into from
Jul 21, 2024
Merged

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Jul 20, 2024


  1. 一开始是 @Dunqingchore: using swc instead of esbuild to fix tree shaking that doesn't work #583 ,将 cjs 的编译方式从 esbuild 改成了 swc,从而尝试解决顶层 var 导致 tree-shaking 失效的问题(如 esm模式按需引入模式失效 #307 https://github.com/ant-design/ant-design-icons/issues/486)。
  2. chore: using swc instead of esbuild to fix tree shaking that doesn't work #583 随即导致了在 node 环境下无法正确引用的问题,cjs 的打包方式改成 swc 后存在问题:Missing support for type: "module" on Node? #605
  3. 后续对 father 配置的两次更新又把 chore: using swc instead of esbuild to fix tree shaking that doesn't work #583 解决掉的问题改回来了:fix: compile config #588916efcc

因此现在 TreeShaking 也不好使,node 环境下的引用也不好使。

解决方案是先回到 father 的默认编译配置,先把 node 环境下的引用问题解决掉:#605

@afc163 afc163 changed the title fix: import bug in server component(next.js/remix) fix: import bug in server (next.js/remix/bun) Jul 20, 2024
@Dunqing
Copy link
Contributor

Dunqing commented Jul 20, 2024

我看下这个 PR 🥲

@Dunqing
Copy link
Contributor

Dunqing commented Jul 20, 2024

tree-shaking 除非配置 exports 否则无解

@afc163
Copy link
Member Author

afc163 commented Jul 20, 2024

tree-shaking 除非配置 exports 否则无解

怎么加,这个 PR 里一起解决了。

@Dunqing
Copy link
Contributor

Dunqing commented Jul 20, 2024

看下这个 https://publint.dev/@ant-design/icons@5.3.7

@Dunqing
Copy link
Contributor

Dunqing commented Jul 20, 2024

esm 的 tree-shaking 应该是正确的,但现在都引了 cjs 的

@afc163
Copy link
Member Author

afc163 commented Jul 20, 2024

ab26cf1 这样对吧?

@Dunqing
Copy link
Contributor

Dunqing commented Jul 20, 2024

ab26cf1 这样对吧?

还得加上icons单独导入的情况

@afc163
Copy link
Member Author

afc163 commented Jul 20, 2024

这要如何写,每一个 icon 都声明一遍?这样写未免太多了吧。

@afc163 afc163 merged commit 67c7ca8 into master Jul 21, 2024
4 checks passed
@afc163 afc163 deleted the fix/cjs-import-bug branch July 21, 2024 05:35
@afc163
Copy link
Member Author

afc163 commented Jul 21, 2024

  • @ant-design/icons@5.4.0-alpha.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment