From e2e487fed03d9f9651f3952eddc52997f7abe78d Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 17 Jun 2024 09:46:08 -0400 Subject: [PATCH] Make sure calls to `forwardRef` are marked as pure (#1192) * Make sure calls to `forwardRef` are marked as pure * Update changelog --- CHANGELOG.md | 4 +++- scripts/build.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f06566bf8..78c07bf7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Improve tree-shakability of React package ([#1192](https://github.com/tailwindlabs/heroicons/pull/1192)) ## [2.1.3] - 2024-03-22 diff --git a/scripts/build.js b/scripts/build.js index e90152dfe..183196ef0 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -23,6 +23,8 @@ let transform = { code = lines.join('\n') } + code = code.replace('React.forwardRef(', '/*#__PURE__*/ React.forwardRef(') + if (format === 'esm') { return code }