Skip to content

fix: resolve #og-image alias when no subpath is given (#615)#617

Merged
harlan-zw merged 2 commits into
mainfrom
fix/615-og-image-alias-dist-runtime
Jun 5, 2026
Merged

fix: resolve #og-image alias when no subpath is given (#615)#617
harlan-zw merged 2 commits into
mainfrom
fix/615-og-image-alias-dist-runtime

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Resolves #615

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

fixSharedPath only rewrote /shared/runtime/ when followed by a trailing slash, so the bare alias registration resolve('./runtime') slipped through as dist/shared/runtime (which does not exist in the published bundle). Switched the matcher to a regex that also accepts end-of-string, so the #og-image alias now resolves to dist/runtime whether or not a subpath is appended.

`fixSharedPath` only rewrote `/shared/runtime/` with a trailing slash,
so `resolve('./runtime')` produced `dist/shared/runtime` (no trailing
slash) and the rewrite never fired. The `#og-image` alias then pointed
at a path that doesn't exist in the published `dist/`.

Match either a trailing slash or end-of-string so bare paths are
rewritten too.
@pkg-pr-new

pkg-pr-new Bot commented May 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-og-image@617

commit: c3bcea5

@harlan-zw

Copy link
Copy Markdown
Collaborator Author

Verified end-to-end against a consumer using the built dist:

  1. Packed the worktree (pnpm pack), installed it into a fresh Nuxt 4.4.6 project.
  2. .nuxt/tsconfig.json now maps #og-image -> .../dist/runtime (was dist/shared/runtime before).
  3. Added a plugin importing useOgImageRuntimeConfig from #og-image/app/utils.
  4. nuxi typecheck -> exit 0. nuxt build -> exit 0.

No virtual type declaration is needed: dist/runtime/app/utils.d.ts already ships, so once the alias resolves correctly the regular file pickup covers types and runtime. The same applies to anything else under #og-image/*.

@harlan-zw harlan-zw merged commit ba5df60 into main Jun 5, 2026
10 checks passed
@harlan-zw harlan-zw deleted the fix/615-og-image-alias-dist-runtime branch June 5, 2026 04:21
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.

#og-image alias resolves to a missing dist/shared/runtime/ directory

1 participant