Get UXP Plugin name?

Heya! Is there a way to get the UXP Plugin name? From manifest or similar?

const pluginName = require("uxp").plugin.name;

Kinda thing?
Would like to use this as a value within the plugin HTML.

I don’t think so. At least I couldn’t find a way. But you could get a panel name of they match

uxp.entrypoints.getPanel(panelId).label

Actually IIRC there’s some private property, but docs clearly state, that using those, might get plugin removed from marketplace

1 Like

You can require your plugin’s manifest:

const manifest = require("/manifest.json"); /* this is relative to your bundle's root folder */
const pluginName = manifest.name;
1 Like

This is not very convenient depending on setup. Eg. I have manifest outside my /src folder where whole plugin lives and only during build process everything fits together. So requiring manifest in this case either will trigger IDE error or will fail the build. IMO plugin name should be accessible via uxp same as panels are

Edit: Found the path I mentioned previously:

uxp.entrypoints._pluginInfo._pluginInfo.name

Why can’t this be available publicly?

1 Like

Just found one more way as a workaround :sweat_smile:

Array.from(uxp.pluginManager.plugins).find(plugin => plugin.id === yourPluginID).name
1 Like

Thanks all! Very helpful!

My code for anyone else!

// Get plugin name and add it to all existing references of element .pluginName
const manifest = require("./manifest.json");
const pluginName = manifest.name;
const showPluignName = Array.from(document.querySelectorAll('.pluignName'))
showPluignName.forEach((element) => {
    element.innerHTML += pluginName
});