-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Hello, thanks for this library!!
The problem
I am building a component library on top of heroicons and headlessui, but I am having some problem to make my component library tree-shakable. The components that using heroicons are not tree-shakable.
I am using this tool (agadoo) to check tree-shakable config, but I am not sure if we can trust 100% in it.
I saw in the source code that you guys annotate the with PURE annotations, but when I run agadoo with this component its fails
const React = require("react");
function AdjustmentsHorizontalIcon({
title,
titleId,
...props
}, svgRef) {
return /*#__PURE__*/React.createElement("svg", Object.assign({
xmlns: "http://www.w3.org/2000/svg",
fill: "none",
viewBox: "0 0 24 24",
strokeWidth: 1.5,
stroke: "currentColor",
"aria-hidden": "true",
"data-slot": "icon",
ref: svgRef,
"aria-labelledby": titleId
}, props), title ? /*#__PURE__*/React.createElement("title", {
id: titleId
}, title) : null, /*#__PURE__*/React.createElement("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
d: "M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"
}));
}
const ForwardRef = React.forwardRef(AdjustmentsHorizontalIcon);
module.exports = ForwardRef;
The fix
The fix, it's only add one more pure annotation in forwardRef function call.
// ....
const ForwardRef = /*#__PURE__*/ React.forwardRef(AdjustmentsHorizontalIcon);
module.exports = ForwardRef;
Metadata
Metadata
Assignees
Labels
No labels