feat(evo-react): switch to component subpath imports#641
feat(evo-react): switch to component subpath imports#641HenriqueLimas wants to merge 2 commits intomainfrom
Conversation
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>
🦋 Changeset detectedLatest commit: dd9e052 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
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.jsonexportsto 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" |
There was a problem hiding this comment.
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.
| "default": "./dist/*.js" | |
| "default": "./dist/*/index.js" |
| }, | ||
| "./*": { | ||
| "types": "./dist/*/index.d.ts", | ||
| "default": "./dist/*/index.js" |
There was a problem hiding this comment.
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.
| "default": "./dist/*/index.js" | |
| "default": "./dist/*.js" |
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@evo-web/react": patch | |||
There was a problem hiding this comment.
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.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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:
Changes:
@evo-web/reactroot entry) entirelysrc/evo-button/→src/button/,src/evo-icon/→src/icon/evo-icon-cart-16.tsx→cart-16.tsx(1036 files regenerated)package.jsonexports:"./icons/*"+"./*"static wildcards — no manual updates needed when adding componentsvite.config.js: dynamic entry discovery via filesystem scanpreserveModules— previously needed so each component's@ebay/skinCSS import was individually tree-shakeable; with subpath exports each entry already isolates its own skin import so this is no longer requiredNotes
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