You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plugin loader: derive id from parent directory when module basename is generic (plugin.js/index.js) #596
The loader derives a plugin's id from the module basename. The natural out-of-tree convention is <name>/plugin.js, so every plugin derives the id plugin, and the (correct) duplicate-id guard refuses to boot until each entry carries an explicit id.
When the basename is generic (plugin, index), derive the id from the parent directory: relay/plugin.js → relay. Backward-compatible (explicit id still wins); removes the most common plugin-author footgun.
Sharpened while dogfooding: this doesn't just annoy config authors — it blocks the --plugin CLI entirely for any repo using the <name>/plugin.js convention.
Concrete repro, loading two plugins from the out-of-tree plugins repo (where every plugin is <name>/plugin.js):
jss start --plugin ./relay/plugin.js@/relay --plugin ./dashboard/plugin.js@/dashboard
# Error: plugins: duplicate id 'plugin' — set entry.id to keep the plugins' data dirs apart
Both basenames reduce to the id plugin → collision on the second flag. And the --plugin <module[@prefix]> flag has no field to set an explicit id (unlike createServer({ plugins }) / a config file, where you can). So the fix suggested here — derive the id from the parent directory when the basename is generic (plugin, index) — isn't just ergonomics: it's what makes the CLI usable at all for the conventional layout. With it, ./relay/plugin.js → relay, ./dashboard/plugin.js → dashboard, and the bare --plugin form Just Works.
Today the workaround is the explicit-id form only:
i.e. a config file or createServer(...) — the CLI --plugin flag can't reach it. All 33 plugins in the plugins repo hit this; it's why they're loaded via serve.js (explicit ids) rather than jss --plugin.
Activity
melvincarvalho commentedon Jul 11, 2026
Sharpened while dogfooding: this doesn't just annoy config authors — it blocks the
--pluginCLI entirely for any repo using the<name>/plugin.jsconvention.Concrete repro, loading two plugins from the out-of-tree plugins repo (where every plugin is
<name>/plugin.js):jss start --plugin ./relay/plugin.js@/relay --plugin ./dashboard/plugin.js@/dashboard # Error: plugins: duplicate id 'plugin' — set entry.id to keep the plugins' data dirs apartBoth basenames reduce to the id
plugin→ collision on the second flag. And the--plugin <module[@prefix]>flag has no field to set an explicitid(unlikecreateServer({ plugins })/ a config file, where you can). So the fix suggested here — derive the id from the parent directory when the basename is generic (plugin,index) — isn't just ergonomics: it's what makes the CLI usable at all for the conventional layout. With it,./relay/plugin.js→relay,./dashboard/plugin.js→dashboard, and the bare--pluginform Just Works.Today the workaround is the explicit-
idform only:{ "plugins": [ { "id": "relay", "module": "./relay/plugin.js", "prefix": "/relay" }, { "id": "dashboard", "module": "./dashboard/plugin.js", "prefix": "/dashboard" } ] }i.e. a config file or
createServer(...)— the CLI--pluginflag can't reach it. All 33 plugins in the plugins repo hit this; it's why they're loaded viaserve.js(explicit ids) rather thanjss --plugin.fix(plugins): derive plugin id from parent dir for generic basenames (#…
bump version to 0.0.219