microsoft / fluentui-system-icons

Fluent System Icons are a collection of familiar, friendly and modern icons from Microsoft.
https://aka.ms/fluentui-system-icons
MIT License
5.68k stars 501 forks source link

Package size of `react-icons` is optimizable #561

Closed kkocdko closed 1 year ago

kkocdko commented 1 year ago

Now it produce the code like this:

const AccessibilityCheckmarkFilledIcon = props => {
  const {
    fill: primaryFill = 'currentColor',
    className
  } = props;
  return React.createElement("svg", Object.assign({}, props, {
    width: "1em",
    height: "1em",
    viewBox: "0 0 20 20",
    xmlns: "http://www.w3.org/2000/svg",
    className: className
  }), React.createElement("path", {
    d: "M10 6a2 2 0 1 0 0...",
    fill: primaryFill
  }));
};
// And many many repeats...

I think we can reduce the duplicate code by using a helper function.

export const AccessibilityCheckmarkFilledIcon = createFluentIcon('AccessibilityCheckmarkFilledIcon', 20, ['M10 6a2 2 0 1 0 0...']);
// And more

The lib-cjs directory also cause double size.

I'll start to working for this.

kkocdko commented 1 year ago

Work will continue in https://github.com/microsoft/fluentui/issues/25989 .