From 4ea2734aded790d0e5376e03abb135048a225fac Mon Sep 17 00:00:00 2001 From: Florian Egger Date: Tue, 19 May 2026 18:21:17 +0200 Subject: [PATCH] fix: move obsidian to devDependencies, improve shim export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - package.json: move obsidian from dependencies to devDependencies (it is a type stub — having it in dependencies risks shadowing Obsidian's built-in API if node_modules is present in the plugin folder) - main.js: explicitly extract default export from dist/main.js so the shim works with both plugin.default and direct-export loader patterns --- main.js | 7 ++++--- package.json | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index f3f2f23..c01fb26 100644 --- a/main.js +++ b/main.js @@ -1,3 +1,4 @@ -// Shim entry point — re-exports the compiled plugin from dist/ -// Obsidian expects main.js at the plugin root alongside manifest.json. -module.exports = require('./dist/main.js'); +// Shim entry point — Obsidian expects main.js at the plugin root. +// Re-exports the compiled plugin from dist/, handling both default and named exports. +const plugin = require('./dist/main.js'); +module.exports = plugin.default || plugin; diff --git a/package.json b/package.json index a589b23..66b33bd 100755 --- a/package.json +++ b/package.json @@ -27,12 +27,12 @@ "eslint": "^8.56.0", "jest": "^29.7.0", "jest-environment-jsdom": "^30.3.0", + "obsidian": "^1.4.11", "prettier": "^3.2.5", "ts-jest": "^29.1.2", "typescript": "^5.3.3" }, "dependencies": { - "chromadb": "^1.5.3", - "obsidian": "^1.4.11" + "chromadb": "^1.5.3" } }