FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Plugin loader: derive id from parent directory when module basename is generic (plugin.js/index.js) · Issue #596 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub

Plugin loader: derive id from parent directory when module basename is generic (plugin.js/index.js) #596

Description

What happens

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.

Repro

createServer({ plugins: [
  { module: 'relay/plugin.js', prefix: '/relay' },
  { module: 'webrtc/plugin.js', prefix: '/webrtc' },
] })
// → duplicate plugin id 'plugin'

Evidence

All 32 plugins in https://github.com/JavaScriptSolidServer/plugins hit this; compose.test.js and serve.js there carry 32 hand-written id: fields solely to dodge it. See REPORT.md ("Five loader/core bugs", #1).

Suggested fix

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpluginCould be implemented as a plugin (#206); core/plugin line defined in #564

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL