Switch Heroicons imports to individual direct paths in admin pages, introductions and editor#23285
Merged
leonidasmi merged 26 commits intoMay 28, 2026
Conversation
…le size
Replaces barrel imports (e.g. `import { X } from "@heroicons/react/outline"`)
with direct ESM path imports (e.g. `import X from "@heroicons/react/outline/esm/X"`)
across all ~96 files in packages/js/src/, allowing the bundler to tree-shake unused icons.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ip-size-by-switching-heroicons-imports-to-individual-esm-paths
Contributor
Author
|
/build-zip |
|
📦 Plugin zip built successfully! Download it from the workflow run. |
Contributor
Author
|
/build-zip |
|
📦 Plugin zip built successfully! Download it from the workflow run. |
Prevents importing from @heroicons/react/outline and @heroicons/react/solid barrel paths across all packages that use Heroicons, enforcing individual ESM path imports instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
/build-zip |
|
📦 Plugin zip built successfully! Download it from the workflow run. |
Coverage Report for CI Build 0Coverage at 34.859% (no base build to compare)Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
…ontend Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ata-previews and related-keyphrase-suggestions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b8b46e5 to
752a560
Compare
Settings Heroicons import changes extracted to a separate PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…to PR #23295 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ved to PR #23297 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ews files — moved to PR #23298 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ip-size-by-switching-heroicons-imports-to-individual-esm-paths
…ip-size-by-switching-heroicons-imports-to-individual-esm-paths
…aseButton Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The PHP-side should_show() for this introduction has been hardcoded to false, so the component is never served to the frontend. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
leonidasmi
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces barrel imports (e.g.
import { X } from "@heroicons/react/outline") with individual direct path imports (e.g.import X from "@heroicons/react/outline/X") across admin pages and introductions in packages/js/src/, allowing the bundler to tree-shake unused icons.Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
@heroicons/react/outline,@heroicons/react/solid). Webpack cannot fully tree-shake barrel re-exports, so any import from these barrels pulls in every icon in the set — adding significant unused SVG data to the bundle. Individual path imports (e.g.@heroicons/react/outline/ExternalLinkIcon) resolve to separate files, letting Webpack include only the icons actually used.no-restricted-importsESLint rules are added topackages/js/eslint.config.mjsto ban future barrel imports from@heroicons/react/outlineand@heroicons/react/solid, preventing regression without manual review.packages/js/src/(admin pages and introductions). The companion PR 1230 switch heroicons individual imports in UI library #23292 (already merged) applied the same pattern to the@yoast/ui-librarypackage.@heroicons/react/outline/ExternalLinkIcon) rather than the/esm/sub-path (@heroicons/react/outline/esm/ExternalLinkIcon). Both achieve tree-shaking; the direct path resolves to the CJS module, which is consistent with Webpack's handling in this project's current build configuration.packages/js/src/introductions/components/modals/google-docs-addon-upsell.jswas deleted entirely. The PHP-sideshould_show()for this introduction has been hardcoded tofalse, meaning the component is never served to the frontend, making it dead code.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Open the browser console (F12) before starting — verify no JS errors related to icon imports appear at any point.
Academy page (Yoast SEO → Academy)
Redirects (Yoast SEO → Redirects — requires Premium)
Introductions / announcement modals
Verify each modal shows its icon correctly in one of the Admin pages:
Trigger the black friday promotion by editing
src/promotions/domain/black-friday-promotion.phpline 16:For Premium users only. Shows when:
For free users only. Two cases:
Both cases also require: user is on a Yoast SEO admin page, hasn't seen another introduction within the last
week, and hasn't already dismissed this one.
Plans page (if accessible)
Installation success screen (shown after fresh install)
Support page (Yoast SEO → Support)
Black Friday promotion banner (seasonal — test if the banner is currently active)
Trigger the black friday promotion by editing
src/promotions/domain/black-friday-promotion.phpline 16:Related keyphrase button
Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand committed the results, if my PR introduces or edits images or SVGs.Innovation
innovationlabel.Fixes https://github.com/Yoast/reserved-tasks/issues/1234