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

chore: using swc instead of esbuild to fix tree shaking that doesn't work #583

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

Dunqing
Copy link
Contributor

@Dunqing Dunqing commented Aug 1, 2023

原因

由于最终使用 esbuild 构建,而 esbuildtop-level-var 的问题,将会把打包的产物中的 constlet 转为 var,因此 tree shaking 发现如果一个变量是以 var 声明的会认为这个变量包含 side effect,所以将不会对其进行 tree shaking。

解决方案

  1. transformer 设置为 swc
  2. 将生成的代码中包含的 var 改写成 const

@MadCcc MadCcc merged commit 7d64460 into ant-design:master Aug 1, 2023
Comment on lines +3 to +5



Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空行这么多

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

Successfully merging this pull request may close these issues.

3 participants