Tsconfig Alias Image Resolver

approvedunreviewed

by CMSZ

Read tsconfig.json compilerOptions.paths and resolve @/… style image paths in real time so images render in Obsidian.

↓ 94 downloadsUpdated 2mo agoMIT

Obsidian Tsconfig Alias Image Resolver

Resolve @/… style path-alias image references (from tsconfig.json compilerOptions.paths) in real time, so images render in Obsidian reading view and live preview — without modifying your notes on disk.

Why

Astro / Vite projects (e.g. Astro Paper) reference images with aliases like ![alt](@/assets/images/example.jpg). Obsidian does not understand the @ alias, so the image shows as "file not found". This plugin reads the vault's tsconfig.json and rewrites those paths at render time.

Features

  • Reads compilerOptions.paths from the vault-root tsconfig.json (e.g. { "@/*": ["./src/*"] } → @/ → src/).
  • Rewrites rendered <img> elements and Obsidian internal-embed placeholders in real time (markdown post-processor + MutationObserver), in both reading view and live preview.
  • Never edits note files on disk — everything happens in the render layer.
  • Auto-reloads when tsconfig.json changes; also provides a "Reload tsconfig aliases" command.
  • Non-alias relative paths that Obsidian fails to resolve are additionally tried as vault-root paths.

Install

  1. Build the plugin (see below).
  2. Copy main.js and manifest.json into <your-vault>/.obsidian/plugins/tsconfig-alias/.
  3. Enable Tsconfig Alias Image Resolver in Settings → Community plugins (disable Restricted mode if needed).

Development

npm install
npm run build   # bundles src/main.ts and outputs main.js to the repo root

npm run dev starts esbuild in watch mode (output goes to the repo root).

Requirements

  • Obsidian v1.0+
  • A tsconfig.json at the vault root with compilerOptions.paths

License

MIT

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.