Replies: 3 comments 2 replies
-
Hi there, Notably, the "plugin name" has to match up exactly for UMD style plugins and it was not matching for our docs. To be specific: in the config.json, where it says This has to match up with multiple places in the UMD plugin ;(function () {
class Plugin {
name = 'MyPlugin' <-- Here
version = '1.0'
install(pluginManager) { /* ... */ }
configure(pluginManager) {}
}
// the plugin will be included in both the main thread and web worker, so
// install plugin to either window or self (webworker global scope)
;(typeof self !== 'undefined' ? self : window).JBrowsePluginMyPlugin = // <-- AND here, with the naming JBrowsePlugin + YourPluginName
{
default: Plugin,
}
})() The UMD plugin system is quite picky in this way However, we also support "ESM plugins" (ESM is an alternative javascript module format that is basically the modern way to do things) They are easier to write. Notably, before 2024 browsers were a little less compatible with pure ESM plugins, but now there is broad browser compatibility I added a section to our docs to fix and clarify these issues. We might be able to make ESM the default too because it is less picky about the naming Updated doc page |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Thank you very much, I've now got it working! One last (very minor) question. I wanted to incorporate icons from the mui library in the menu, much like the exclamation and question mark in the current "Help" menu. From what I understand, JBrowse uses the MUI library, and reexports parts of it through the PluginManager for use in plugins. The email icon can be loaded through through Am I right when I say that I cannot access the icons currently? Or is there another way to get there? Looking forward to your input on this, thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
I'm having problems using some the following no-build plugins that are available on the JBrowse website.
Both the menu-modifying plugin in the first black box here, and the myplugin.js mentioned under "importing with jbrequire here, are giving me an error that I cannot seem to fix.
If I copy and paste the literal code into a file, and refer to the file in my config files like so
{ "name": "MyPlugin", "umdLoc": { "uri": "plugins/myplugin.js" } },
I get an error
Error: Failed to load UMD bundle for MyPlugin, JBrowsePluginMyPlugin is undefined
As far as I understand, these plugins should be no-build, so I can just copy and paste the code, and they should work (after which I can modify them to my needs).
Is there something I'm doing wrong in my config file?
Do I need to configure the copied text?
Do i need a dependency of which I"m not aware.
Any help is very welcome
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions