Skip to content

feat(evo-react): switch to component subpath imports#641

Open
HenriqueLimas wants to merge 2 commits intomainfrom
evo-react-subpaths
Open

feat(evo-react): switch to component subpath imports#641
HenriqueLimas wants to merge 2 commits intomainfrom
evo-react-subpaths

Conversation

@HenriqueLimas
Copy link
Copy Markdown
Member

  • Fixes #

Description

Reverses ADR 0004's hybrid import strategy and adopts a consistent subpath-per-component pattern for @evo-web/react. All exports now use subpath imports for guaranteed tree-shaking regardless of bundler configuration.

New import patterns:

// Components
import { EvoButton } from "@evo-web/react/button";
import { EvoIconProvider } from "@evo-web/react/icon";

// Icons
import { EvoIconCart16 } from "@evo-web/react/icons/cart-16";

Changes:

  • Remove barrel export (@evo-web/react root entry) entirely
  • Rename src/evo-button/src/button/, src/evo-icon/src/icon/
  • Rename icon files: evo-icon-cart-16.tsxcart-16.tsx (1036 files regenerated)
  • package.json exports: "./icons/*" + "./*" static wildcards — no manual updates needed when adding components
  • vite.config.js: dynamic entry discovery via filesystem scan
  • Remove preserveModules — previously needed so each component's @ebay/skin CSS import was individually tree-shakeable; with subpath exports each entry already isolates its own skin import so this is no longer required
  • New ADR 0006 superseding ADR 0004

Notes

This is a breaking change for any consumers of @evo-web/react, but the package is still experimental with no external consumers, so migration cost is zero. Versioned as a patch per the experimental status.

Screenshots

N/A — no UI changes.

Checklist

  • I verify the linked issue has been triaged ("Needs Triage" label removed)
  • I verify all changes are within scope of the linked issue
  • I added/updated/removed testing (Storybook in Skin) coverage as appropriate

Replace barrel export with per-component subpath imports for guaranteed
tree-shaking. Rename src dirs (evo-button→button, evo-icon→icon) and
icon files (evo-icon-cart-16→cart-16). Update package.json exports to
wildcard patterns and vite.config.js to dynamic entry discovery.
Supersedes ADR 0004 with new ADR 0006.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 24, 2026 22:48
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

🦋 Changeset detected

Latest commit: dd9e052

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@evo-web/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR switches @evo-web/react to a consistent subpath-per-component import strategy (and removes the root barrel entry) to ensure reliable tree-shaking and a uniform consumer API.

Changes:

  • Updates component/icon imports and regenerates icon filenames to use clean subpaths (e.g. @evo-web/react/button, @evo-web/react/icons/cart-16).
  • Updates the icon import/generation script and Storybook usage docs to match the new paths.
  • Reworks package.json exports to rely on wildcard subpath mappings; adds ADR 0006 + changeset.

Reviewed changes

Copilot reviewed 6 out of 1059 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/evo-react/src/button/button.tsx Updates internal icon import to new src/icon/ location
packages/evo-react/src/button/button.stories.tsx Updates Storybook docs to import from @evo-web/react/button
packages/evo-react/scripts/import-svg.ts Updates generator paths/output names and docs to new subpath scheme
packages/evo-react/package.json Replaces root/barrel exports with wildcard subpath exports
docs/adr/0006-evo-react-subpath-imports.md Documents and justifies the move to subpath imports
.changeset/evo-react-subpath-imports.md Declares a patch release for the breaking import-path change

"default": "./dist/evo-icon/icons/evo-icon-*.js"
"./*": {
"types": "./dist/*/index.d.ts",
"default": "./dist/*.js"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JS export target (./dist/*.js) conflicts with ADR 0006, which documents ./dist/*/index.js for component exports. Please reconcile the ADR and the implementation (either update the ADR snippet to reflect dist/<entry>.js, or adjust exports to match the documented dist/<entry>/index.js) so consumers aren’t misled about the published entry layout.

Suggested change
"default": "./dist/*.js"
"default": "./dist/*/index.js"

Copilot uses AI. Check for mistakes.
},
"./*": {
"types": "./dist/*/index.d.ts",
"default": "./dist/*/index.js"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exports example shows default: ./dist/*/index.js, but packages/evo-react/package.json currently publishes default: ./dist/*.js for ./*. Update this ADR example (or the actual exports) so the documented export map matches what is shipped.

Suggested change
"default": "./dist/*/index.js"
"default": "./dist/*.js"

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,5 @@
---
"@evo-web/react": patch
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description includes Fixes # without an issue number, but the repo checklist states an issue is required for all PRs. Please update the PR description to reference the correct issue (e.g., Fixes #12345) or remove the Fixes line if this work is not tracked by an issue.

Copilot uses AI. Check for mistakes.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants