Install required tools
Install these once per machine.
| Tool | Why | Download |
|---|---|---|
| Node.js โฅ 18 | Runs esbuild and npm | nodejs.org โ LTS version |
| Git | Version control | git-scm.com |
| VS Code | Editor with TypeScript support | code.visualstudio.com |
Verify in the terminal:
$ node --version # must be v18 or higher $ npm --version $ git --version
VS Code extensions
Install via Ctrl+Shift+X:
dbaeumer.vscode-eslintโ ESLintesbenp.prettier-vscodeโ Prettierusernamehw.errorlensโ Error Lensritwickdey.liveserverโ Live Server (for the docs/ HTML files)
Project structure
main.js and manifest.json must stay in the root. Obsidian only looks there. Never move them into a subfolder.
Symbolic link setup
Keep your repo anywhere on disk and link it into Obsidian's plugin folder. esbuild then writes main.js directly where Obsidian loads it โ no copying needed.
macOS / Linux
ln -s ~/Dev/yaml-path-sync \ ~/Documents/MyVault/.obsidian/plugins/yaml-path-sync
Windows (PowerShell as Administrator)
New-Item -ItemType SymbolicLink ` -Path "C:\...\plugins\yaml-path-sync" ` -Target "C:\Users\Name\Dev\yaml-path-sync"
Verify the link works: ls -la ~/.obsidian/plugins/ โ the folder should show an arrow pointing to your repo path.
Project setup
Do this once after cloning or creating the project.
- 1
Open in VS Code
terminal$ cd ~/Dev/yaml-path-sync $ code .
- 2
Install dependencies
terminal$ npm install added 19 packages in 885ms
This installs esbuild, TypeScript, and the Obsidian type definitions. Run only once (or after changing
package.json). - 3
Enable the plugin in Obsidian
Settings โ Community Plugins โ disable Restricted Mode โ toggle YAML Path Sync on.
โน๏ธIf the plugin doesn't appear, restart Obsidian once after creating the symlink.
Watch mode
Start this at the beginning of every session. Leave it running in the background.
$ npm run dev Watching for changes โฆ (Ctrl+C to stop)
Every time you save src/main.ts, esbuild recompiles in under 100 ms and writes a new main.js automatically. Stop with Ctrl+C.
Alternatively press Ctrl+Shift+B in VS Code to run it as a background task.
Reload the plugin in Obsidian
Obsidian doesn't detect file changes automatically. After each rebuild you need to reload.
| Method | How | Speed |
|---|---|---|
| Hot Reload (recommended) | Install the community plugin "Hot Reload" โ it watches main.js and reloads automatically after every rebuild. | ~1 s โ automatic |
| Toggle off / on | Settings โ Community Plugins โ toggle off, then on. | ~3 s |
| Restart Obsidian | Close and reopen. | ~10 s |
Debug
Open DevTools in Obsidian
- Windows / Linux:
Ctrl + Shift + I - macOS:
Cmd + Option + I
Chrome DevTools opens โ identical to what you see in a browser.
If the shortcut doesn't work, start Obsidian from the terminal:
macOS: open -a Obsidian --args --remote-debugging-port=9229
Windows: obsidian.exe --remote-debugging-port=9229
Console tab
All console.log() calls from the plugin appear here. Filter by typing YAML Path Sync in the filter box.
YAML Path Sync: loaded. YAML Path Sync: "path" set on create โ 02 Areas/C/Pointer C.md YAML Path Sync: "path" updated โ Archiv/C/Pointer C.md
Add your own debug output anywhere in src/main.ts:
console.log('content:', content); console.log('fieldExists:', fieldExists); console.log('settings:', this.settings);
Breakpoints (Sources tab)
Because watch mode compiles with inline source maps, DevTools shows the original TypeScript โ not compiled JS.
- Click the Sources tab in DevTools
- Find
src/main.tsin the file tree - Click a line number to set a breakpoint
- Trigger the action in Obsidian (create or move a file)
- Execution pauses โ hover over any variable to inspect its value
Attach VS Code debugger (optional)
Start Obsidian with the remote debug port, then press F5 in VS Code and select "Attach to Obsidian". Breakpoints set in src/main.ts will pause execution directly inside VS Code.
Source maps are only included in dev builds (npm run dev). The production build has none โ use dev builds when debugging.
Type checking
esbuild skips type checks. Run this explicitly to catch type errors before releasing:
$ npm run check # No output = no errors โ src/main.ts(42,5): error TS2322: ...
Production build
$ npm run build Build complete.
npm run dev | npm run build | |
|---|---|---|
| Source maps | โ Inline | โ None |
| Minified | โ No | โ Yes |
| Keeps running | โ Watch mode | โ Exits |
| Use for | Development | Releases |
Always run npm run build before releasing. Dev builds contain large inline source maps and must not be shipped.
Release
- 1
Bump the version
Update
"version"in bothmanifest.jsonandpackage.jsonto the new version, e.g."1.3.1". - 2
Production build + commit
terminal$ npm run build $ git add . $ git commit -m "Release v1.3.1" $ git push
- 3
Tag and push โ triggers the GitHub Action
terminal$ git tag v1.3.1 $ git push origin v1.3.1
The workflow at
.github/workflows/release.ymldetects thev*tag, builds the plugin, and creates a GitHub release withmain.jsandmanifest.jsonattached. Watch progress at GitHub โ Actions.
Troubleshooting
| Problem | Fix |
|---|---|
npm: command not found | Install Node.js from nodejs.org and reopen the terminal |
Cannot find module 'obsidian' | Run npm install |
| Plugin not in Obsidian | Check symlink points to correct folder. Restart Obsidian. |
| Changes not visible after saving | Confirm npm run dev is running. Reload the plugin (or use Hot Reload). |
| DevTools shows compiled JS, not TypeScript | Use npm run dev โ source maps are only in dev builds |
| GitHub Action not triggered | Tag must start with v. Use git push origin v1.3.1 |
| Action runs but no release files | Workflow file must be at .github/workflows/release.yml โ not workflows/release.yml |