Ant Design Tree shaking with CRA

Viewed 1385

is there any way to do "tree shaking" of Antd with React 16.13 (CRA) i tried this tutorial https://www.npmjs.com/package/babel-plugin-import in package.json

"plugins": [
  ["import", { "libraryName": "antd", "style": true}, "antd"]
]

but after build all build files are with the same size. Should I expect anything else? Any advice about three shakings of Antd. Thanks

1 Answers

You should add those 3 lines into .babelrc instead of package.json

And you might want to replace moment.js from antd with dayjs to reduce more bundle size.

Related