You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Downstream users are encouraged to manually import using the form:
importTimelinefrom'antd/es/timeline'
Unfortunately, if not using an advanced tree shaking implementation like Webpack, this currently results in the entire @ant-design/icons and @ant-design/icons-svg packages being pulled in, as the destructuring import of icons first pulls in @ant-design/icons/lib/index.js
What problem does this feature solve?
As things stand, imports of icons inside of antd itself use destructuring to pull in icons from @ant-design/icons:
ant-design/components/timeline/Timeline.tsx
Line 3 in e59d606
Downstream users are encouraged to manually import using the form:
Unfortunately, if not using an advanced tree shaking implementation like Webpack, this currently results in the entire
@ant-design/icons
and@ant-design/icons-svg
packages being pulled in, as the destructuring import of icons first pulls in@ant-design/icons/lib/index.js
This is likely also why some folks have provided solutions such as https://github.com/DavidSichau/antd-fa-icons, since tree shaking appears not to work for everyone.
What does the proposed API look like?
If the imports inside of antd were updated to follow antd's own advice, many more downstream bundlers would correctly pull in only the relevant code.
The idea would be to change the imports from this:
ant-design/components/timeline/Timeline.tsx
Line 3 in e59d606
to this:
Thanks very much. :)
The text was updated successfully, but these errors were encountered: