Node RED Plugins

Ok...

Having the experience of building nodes, I am prepping a new release of one.
This time around, it has plugins, that need to be initialised prior to any instance of my normal flow editor nodes.

One thing I am confused about.

  • Do they require a matching .html file?

My plugins are of the following shape.

  • Backend (A few admin hooks for example)
  • Front End (Loading of client libraries, side bar etc etc)

So do I

  • A (both using the same type name)
    • my-plugin.js
    • my-plugin.html

or

  • B (separate plugins - and type names)
    • my-plugin-backend.js
    • my-plugin-frontend.html

Looking at examples, it seems they need to be unique - although working together

Thanks

From what I remember, you can have all three cases:

  • HTML + JS (i.e. my-plugin.html and my-plugin.js)
  • HTML
  • JS

What I am sure of are the first two options.

1 Like

I have had different results across Node RED Versions - hence my need to get an answer

it feels "natural" that it should work the same as standard nodes (option 1 in your reply ). @knolleary ?

A plugin can have either or both files. It depends if it is a frontend (.html) or backend (.js) plugin. There is no dependency between them.

Here you can see Node-RED Debugger has both files and they each register their plugin with the corresponding RED api object. (Ignore the fact the .js file here is a .ts file - was my first attempt at using TypeScript)

1 Like

Thanks @knolleary

So having a look at the debugger.

  • Both will use the same type name
  • Both will register via the RED (registerPlugin) API
  • Register the JS file (Only) in package.json

This matches the approach of standard nodes - thanks

Hey... im not here to judge :wink: