Skip to content

fix: resolve compiler peer dependencies from unplugin-icons instead of local-pkg - #437

Open
exKAZUu wants to merge 1 commit into
unplugin:mainfrom
exKAZUu:fix/resolve-peer-compilers-from-package
Open

exKAZUu wants to merge 1 commit into
unplugin:mainfrom
exKAZUu:fix/resolve-peer-compilers-from-package

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Aug 25, 2026

Copy link
Copy Markdown

The vue3, jsx and qwik compilers load their peer dependency with importModule('@vue/compiler-sfc') etc. Since local-pkg 1.x, importModule(name) is a plain import(name) evaluated inside local-pkg, so the peer is resolved relative to local-pkg's location. That only works when the peer is hoisted next to local-pkg.

With Bun's isolated linker + global store (globalStore = true in bunfig.toml), local-pkg lives in ~/.bun/install/cache/links/local-pkg@…/ and only sees its own dependencies, so a Slidev build fails with:

[plugin unplugin-icons]
Error: Cannot find package '@vue/compiler-sfc' imported from /Users/…/.bun/install/cache/links/local-pkg@1.2.1-…/node_modules/local-pkg/dist/index.mjs

The peer is linked next to unplugin-icons itself though (it is a declared optional peer), so this PR resolves the module from unplugin-icons first (import.meta.url) and falls back to the project cwd, then imports the resolved path. The three compilers share a small importPeerModule helper.

Verified with a Slidev deck installed by Bun 1.4.0 with the global store: 5 errors before, builds fine with the patched dist. pnpm lint, pnpm test (added a small test for the vue3 compiler) and pnpm build pass; pnpm typecheck fails on main already for an unrelated Awaitable mismatch.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

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