Browse Source

docs: Update tree-shaking documentation (#39847)

* Update getting-started.zh-CN.md

* Update getting-started.en-US.md

* Update introduce.zh-CN.md

* Update introduce.en-US.md
pull/39853/head
afc163 2 years ago
committed by GitHub
parent
commit
6a32516537
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      docs/react/getting-started.en-US.md
  2. 10
      docs/react/getting-started.zh-CN.md
  3. 2
      docs/react/introduce.en-US.md
  4. 2
      docs/react/introduce.zh-CN.md

8
docs/react/getting-started.en-US.md

@ -112,14 +112,6 @@ Jest does not support `esm` modules, and Ant Design uses them. In order to test
`antd` supports tree shaking of ES modules, so using `import { Button } from 'antd';` would drop js code you didn't use.
If you see logs like in the screenshot below, you might still be using `webpack@1.x` or have a wrong webpack config which can't support tree shaking.
```
You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size. Please upgrade webpack or check the config.
```
> ![console warning](https://zos.alipayobjects.com/rmsportal/GHIRszVcmjccgZRakJDQ.png)
## Customize your Workflow
If you want to customize your workflow, we recommend using [webpack](http://webpack.github.io/) to build and debug code. You can try out plenty of [boilerplates](https://github.com/enaqx/awesome-react#react-tools) available in the React ecosystem.

10
docs/react/getting-started.zh-CN.md

@ -102,15 +102,7 @@ render(<App />, document.getElementById('root'));
## 按需加载
`antd` 默认支持基于 ES modules 的 tree shaking,对于 js 部分,直接引入 `import { Button } from 'antd'` 就会有按需加载的效果。
如果你在开发环境的控制台看到下面的提示,那么你可能还在使用 `webpack@1.x` 或者 tree shaking 失效,请升级或检查相关配置。
```
You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.
```
![控制台警告](https://zos.alipayobjects.com/rmsportal/GHIRszVcmjccgZRakJDQ.png)
`antd` 默认支持基于 ES modules 的 tree shaking,直接引入 `import { Button } from 'antd';` 就会有按需加载的效果。
## 自行构建

2
docs/react/introduce.en-US.md

@ -94,7 +94,7 @@ export default App;
### Use modularized antd
`antd` supports ES modules tree shaking by default for JS part.
`antd` supports ES modules tree shaking by default.
### TypeScript

2
docs/react/introduce.zh-CN.md

@ -94,7 +94,7 @@ export default App;
### 按需加载
`antd` 的 JS 代码默认支持基于 ES modules 的 tree shaking。
`antd` 默认支持基于 ES modules 的 tree shaking。
### TypeScript

Loading…
Cancel
Save