fix: add main.js shim at plugin root for Obsidian loader
Obsidian's plugin loader expects main.js at the plugin root alongside
manifest.json — it does not resolve subdirectory paths in the 'main'
field. Added a thin CommonJS shim that re-exports from dist/main.js.
- main.js: new entry shim (module.exports = require('./dist/main.js'))
- manifest.json: 'main' changed from 'dist/main.js' to 'main.js'
- install.sh: copy main.js shim to plugin folder, verify its presence
- README.md: add main.js to manual install instructions
This commit is contained in:
@@ -65,6 +65,7 @@ Then copy the plugin into your vault:
|
||||
```bash
|
||||
mkdir -p /path/to/vault/.obsidian/plugins/ollama-plugin
|
||||
cp manifest.json /path/to/vault/.obsidian/plugins/ollama-plugin/
|
||||
cp main.js /path/to/vault/.obsidian/plugins/ollama-plugin/
|
||||
cp -r dist /path/to/vault/.obsidian/plugins/ollama-plugin/
|
||||
cp -r node_modules/chromadb /path/to/vault/.obsidian/plugins/ollama-plugin/node_modules/ # optional: only needed for semantic cache
|
||||
```
|
||||
|
||||
+4
-2
@@ -92,8 +92,9 @@ step "Installing into vault"
|
||||
|
||||
mkdir -p "$PLUGIN_DIR"
|
||||
|
||||
# Copy manifest and built output
|
||||
# Copy manifest, entry shim, and built output
|
||||
cp "$SCRIPT_DIR/manifest.json" "$PLUGIN_DIR/"
|
||||
cp "$SCRIPT_DIR/main.js" "$PLUGIN_DIR/"
|
||||
cp -r "$SCRIPT_DIR/dist" "$PLUGIN_DIR/"
|
||||
|
||||
# Copy only necessary runtime dependencies (obsidian and chromadb stubs)
|
||||
@@ -111,8 +112,9 @@ info "Plugin installed to $PLUGIN_DIR"
|
||||
|
||||
step "Verifying installation"
|
||||
|
||||
if [ -f "$PLUGIN_DIR/manifest.json" ] && [ -f "$PLUGIN_DIR/dist/main.js" ]; then
|
||||
if [ -f "$PLUGIN_DIR/manifest.json" ] && [ -f "$PLUGIN_DIR/main.js" ] && [ -f "$PLUGIN_DIR/dist/main.js" ]; then
|
||||
info "manifest.json ✓"
|
||||
info "main.js ✓"
|
||||
info "dist/main.js ✓"
|
||||
else
|
||||
error "Installation verification failed — missing files in $PLUGIN_DIR"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// 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');
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
"author": "Anonymous",
|
||||
"authorUrl": "",
|
||||
"isDesktopOnly": true,
|
||||
"main": "dist/main.js",
|
||||
"main": "main.js",
|
||||
"authorization": [],
|
||||
"permissions": [],
|
||||
"defaultEnabled": true,
|
||||
|
||||
Reference in New Issue
Block a user