Skip to content

fix: resolve ESM imports from hoisted dependencies - #26

Merged
zombieJ merged 1 commit into
mainfrom
fix/resolve-hoisted-es-imports
Aug 31, 2026
Merged

fix: resolve ESM imports from hoisted dependencies#26
zombieJ merged 1 commit into
mainfrom
fix/resolve-hoisted-es-imports

Conversation

@zombieJ

@zombieJ zombieJ commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

  • resolve candidate ESM modules with Node's normal lookup rules instead of assuming they live in the current package's node_modules
  • support hoisted and workspace dependencies while preserving the existing behavior for standalone repositories
  • keep /lib/ imports unchanged when no matching ESM module is available
  • add Node test coverage and run it in CI and before publishing

Context

This fixes the module lookup failure behind ant-design/ant-design-icons#760. In that monorepo, Father runs from packages/icons-react, while @ant-design/icons-svg is hoisted to the repository root. The previous filesystem check therefore missed the existing ESM build and left CommonJS imports in the React ESM output.

Once this plugin is released and adopted, the local alias workaround in ant-design/ant-design-icons#768 can be removed.

Related to #4.

Verification

  • npm run build
  • npm test — 3/3 passed
  • npm run lint
  • father doctor
  • verified the built plugin rewrites the real hoisted @ant-design/icons-svg/lib/asn/SmileOutlined import to @ant-design/icons-svg/es/asn/SmileOutlined
  • Prettier and git diff --check

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 740a6dfd-a9a7-423e-b405-a10a5c80bb58


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zombieJ
zombieJ merged commit 8b39aaa into main Aug 31, 2026
6 checks passed
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.

1 participant